What does a TOML to JSON converter do?
TOML shows up in Cargo.toml, pyproject.toml, Hugo configs and many tool settings. JSON is what scripts, APIs and most programming languages read without extra libraries. Converting from one to the other lets you inspect a config as plain data or feed it to something that only accepts JSON.
This TOML to JSON converter includes its own compact parser. Table headers such as [profile.release] become nested objects. Each [[servers]] block adds one object to an array. Dotted keys like a.b.c = 1 expand into nested objects, and quoted keys can contain spaces. Arrays can span several lines, and inline tables can nest.
It is stricter than a simple line reader. Bad syntax, such as a missing value or an unclosed string, shows a parse error with a line number. Still, it is not a full TOML validator: it does not catch duplicate keys or redefined tables. Use Sort keys alphabetically if you need stable output for diffs. To go the other way, use the JSON to TOML converter.
How to convert TOML to JSON here
- Paste your TOML into TOML Input, or press Sample to load a Cargo-style file.
- Choose Indent: 2 or 4 spaces.
- Tick Sort keys alphabetically if you want object keys in order.
- Click Convert. If the syntax cannot be parsed, a red message appears instead of JSON.
- Check types: strings stay quoted, numbers are bare, dates appear as strings.
- Press Copy, or Download .json to save output.json.
What this TOML parser supports
Tables and array tables
[a.b] creates nested objects and [[a.b]] appends to an array. Sub-tables under an array item attach to the last item.
Dotted and quoted keys
Keys such as a.b = 1 and "my key" = 2 or 'q r' are handled, including in table headers.
Inline tables and multi-line arrays
Values like { version = "1", features = ["a", "b"] } and arrays split over several lines with comments inside are read.
Multi-line strings
Triple-quoted basic and literal strings are supported, as are escapes such as \n and \u00e9.
Number formats
Underscores in numbers, hex, octal, binary, signs and exponents are converted to decimal JSON numbers.
Sorted keys option
Sorts keys at every object level, which makes the JSON easier to compare between versions.
Who converts TOML to JSON
- Reading Cargo.toml or pyproject.toml as data. Turn a manifest into JSON to inspect dependencies or pass it to a script that has no TOML library.
- Checking a Hugo or static site config. Verify how nested tables and arrays resolve before you rely on them in a template.
- Feeding a JSON-only API or tool. A deployment or CI step wants JSON but your source of truth is TOML. Convert once and review the result.
- Debugging a TOML syntax problem. If a file will not parse, the error message gives the line where parsing stopped, which narrows the search.
Tips: dates, comments and error messages
- Dates and times come out as strings, since JSON has no date type.
1979-05-27T07:32:00Zstays that exact text. - Comments are discarded. If a comment matters, copy it into a real key before converting.
- Special floats are lossy:
nanandinfbecome null in JSON output. - Integers above about 9 quadrillion lose precision in JavaScript, so very large IDs should be stored as strings.
- If you want to reshape the result, paste it into the JSON formatter or turn it into a table with JSON to HTML table.
Is it safe? Privacy and limits
Your TOML is parsed by JavaScript in the browser tab. It is not sent to a server, stored, or logged, and no account is needed. The parser is written for this page and is not the official reference implementation. It does not detect duplicate keys or tables defined twice, so treat it as a viewer and converter rather than a validator, and test with your real toolchain.
TOML to JSON converter FAQ
Each [[name]] header starts a new object and appends it to an array called name. Keys written below the header belong to that object until the next header. Sub-tables such as [name.options] that follow attach to the latest item of the array. So two [[servers]] blocks give a servers array with two objects. Nested arrays of tables, like [[a.b]], also work, creating an array under the last a item.
The parser stops when a line breaks the syntax it knows: a key with no equals sign, a value that is not a string, number, boolean, date, array or inline table, an unclosed quote, or text after a value that is not a comment. The red message names the problem and gives the line number where reading stopped. Fix that line and convert again, and repeat if a second error appears further down the file. Remember that bare words like tokio need quotes when used as values.
They are written as JSON strings with the same text as in the TOML, because JSON has no native date type. So 1979-05-27 becomes "1979-05-27" and 07:32:00 becomes "07:32:00". The converter recognises offset, local date-time, local date and local time forms. If your program needs real dates, parse those strings after loading the JSON, for example with your language's date library, since the JSON itself carries no type.
Comments are removed, since JSON cannot store them. Key order follows the order in the TOML file, unless you tick Sort keys alphabetically, which sorts every object. Array order is always kept. Note that TOML itself says table order does not matter, so two files with different orders can mean the same data. Sorting is therefore a good way to compare two configs in a diff, and it does not change any values.
Yes. Arrays can span several lines, contain comments, and end with a trailing comma. Inline tables can nest other inline tables and arrays, such as { version = "1", features = ["full", "rt"] }. Triple-quoted strings, both basic and literal, are supported as well. These were the usual failure points of simple line-by-line TOML readers, so you can paste a real Cargo.toml with long feature lists and expect the arrays to come through whole.
It handles the TOML found in typical config files, but it is not the reference parser. It skips several validity rules, such as rejecting duplicate keys or tables defined twice, and it treats the integer and float types as JavaScript numbers. If a file must be exactly valid TOML, check it with the official tooling for your language, such as the Rust toml crate or Python's tomllib. When in doubt, test with your real parser.
You can use the JSON to read those files as data, for example to list dependencies in a script. Going back to TOML for a real manifest is riskier, because comments are lost and key order may change. Keep the original TOML as the file of record and use the JSON as a view. Never overwrite a manifest with converted output without comparing it. If you need TOML again, the JSON to TOML converter writes it, but it will not restore your comments or your original ordering.
No, conversion happens entirely in your browser. There is no network request, no saved copy and no signup. Download .json simply saves output.json on your computer. Avoid pasting production secrets or tokens into any online page, and replace them with placeholders when you only need the structure. Once the page has loaded, you can even disconnect from the network and it will still convert. It works as long as the page is open.