JSON to TOML Converter
Paste a JSON object and this converter writes it out as TOML in real time. Plain values come first as key equals value lines, nested objects turn into [table] sections, and arrays of objects become [[array of tables]] blocks in document order. Everything runs in your browser, so config files with secrets never leave your device.
How to convert JSON to TOML
- Paste or type your JSON into the JSON input box, or click Load sample to start from an example.
- Make sure the top level is a JSON object, since a TOML document is a table and cannot start from a bare array or value.
- Watch the TOML output box update live as you edit, with any parse error shown in red above it.
- Click Copy to grab the TOML, or Download to save it as config.toml.
Examples
Object with a nested table
{"title":"My App","owner":{"name":"Ada","active":true}}title = "My App" [owner] name = "Ada" active = true
Array of objects becomes an array of tables
{"server":[{"host":"a"},{"host":"b"}]}[[server]] host = "a" [[server]] host = "b"
Numbers and an inline array stay on the top-level keys
{"name":"api","port":80,"ports":[8001,8002]}name = "api" port = 80 ports = [8001, 8002]
Frequently asked questions
Is my data uploaded anywhere?
No. The conversion runs entirely in your browser with JavaScript, so your JSON never touches a server. That makes it safe for config files that contain hostnames, tokens or other private values.
Why does the top level have to be an object?
A TOML document is itself a table, which maps to a JSON object. A bare array or scalar at the root has no valid TOML equivalent, so the converter reports an error asking you to wrap it in an object first.
How are nested objects converted?
Each nested object becomes a TOML table with a dotted header, such as [owner] or [server.db]. Plain key and value pairs for the current table are written first, then the table sections follow so the output parses cleanly.
What happens to arrays?
An array of primitive values is written inline, like ports = [8001, 8002]. An array where every item is an object becomes an array of tables using the [[name]] syntax, one block per item. A mixed array of objects and primitives is treated as an inline array instead.
What about null values?
TOML has no null type, so any JSON null is written as an empty string to keep the document valid. If you would rather drop those keys entirely, remove them from the JSON before converting.
Are special characters escaped?
Yes. Strings use TOML basic-string escaping for quotes, backslashes, tabs, newlines, form feeds and other control characters, and any code point below 0x20 becomes a \uXXXX escape. Keys that are not simple letters, digits, underscores or hyphens are quoted the same way.
How are non-finite numbers handled?
JSON itself cannot hold Infinity or NaN, but if such a value reaches the converter it is written using the TOML spellings inf, -inf and nan rather than being dropped.
Does it preserve the order of my keys?
Yes. Keys are emitted in the same order they appear in the object, with all inline values for a table printed before its nested tables so no key ends up stranded under the wrong header.
Can I convert TOML back to JSON here?
This tool only goes from JSON to TOML. For the reverse direction, or to tidy the JSON first, try a JSON formatter or a dedicated TOML to JSON converter.
Learn more
- TOML tables and arrays of tables explained
How JSON objects and arrays map onto TOML tables, inline arrays and the double-bracket array of tables syntax, with worked examples.
Related tools
JSON to YAML
Convert JSON to YAML online. Paste JSON and get clean, readable YAML with 2-space indentation and no line wrapping. Fast, free and runs in your browser.
JSON Formatter
Format, validate and minify JSON online. Pretty-print with custom indentation, sort keys and catch syntax errors. Runs in your browser.
JSON to CSV
Convert JSON to CSV online. Paste an array of objects and get clean, spreadsheet-ready CSV with the right headers. Runs in your browser.
Air Fryer Converter
Convert any conventional oven recipe to air fryer settings. Lower the temperature by 25 F and cut the cook time by about 20 percent automatically.
Baker's Percentage Calculator
Turn a bread formula into grams with baker's percentages. Flour is 100 percent, enter water, salt and yeast percents to get weights and hydration.
Baking Pan Converter
Swap one baking pan for another and scale the batter to fit. Compares pan areas for round, square and rectangular pans and gives a batter scale factor.