Sooner or later a tool asks for JSON. Your project keeps its settings in a TOML file, the kind with tidy table headers and comments explaining each choice, and the new tool, script or service wants those same settings as JSON. Rewriting the file by hand is slow and error-prone, and one missed brace breaks the whole thing in a way that is hard to spot.
The TOML to JSON Converter on Ovatly does the mechanical work: paste the TOML in, get nested JSON out, in your browser. This guide covers the conversion itself, how to read the output, and exactly what to do when the converter stops and refuses, because those stops are specific and fixable.
Contents
- Quick answer
- What the converter accepts
- How to convert a TOML settings file, step by step
- Worked example: title and owner
- Reading the nested JSON output
- When the conversion stops: the line number is the clue
- Limitations and honest tradeoffs
- Common mistakes
- FAQs
- Conclusion
- References
Quick answer
Open the TOML to JSON Converter, paste your whole TOML settings file into the input, and run the conversion. Tables in the TOML become nested objects in the JSON, arrays of tables become arrays of objects, and values keep their types, with two exceptions to know in advance: dates and times come out as strings, and comments are dropped, because JSON cannot hold either. If the file uses something outside the supported subset, the conversion stops and the error names the line number, so you can fix that line and try again. Nothing is uploaded; parsing happens in your browser.
What the converter accepts
The converter uses a careful parser built for a defined subset of TOML, which covers what settings files actually use. It accepts plain key-value pairs, dotted keys and quoted keys. It accepts table headers in square brackets and array-of-tables headers in double brackets. It accepts all the string forms: basic strings, literal strings and multiline strings. It accepts integers in decimal, hex, octal and binary, floats, booleans, arrays and inline tables. Dates and times are accepted and kept as strings.
Two kinds of values get special, honest treatment. An integer too large to be represented exactly is kept as its original digit string instead of being rounded, and the special float values inf and nan, which JSON cannot express, are likewise kept as strings. In both cases the output shows something visibly different rather than quietly handing you a wrong number.
Anything outside that subset is not guessed at. The conversion stops, the error names the line, and there is no partial output. The next sections show what a normal conversion looks like and how to handle a stop.
How to convert a TOML settings file, step by step
- Open your settings file and copy the whole thing, including the table headers. Partial pastes lose the structure the headers provide.
- Open the TOML to JSON Converter and paste the TOML into the input box.
- Run the conversion. The JSON appears as a nested object that mirrors your file's structure.
- Read the output once against the original: check that each table became an object, that arrays kept their order, and that any dates are present as strings.
- Copy the JSON to the tool or file that needs it, and keep the TOML original unchanged as the version you edit in future.
Worked example: title and owner
Here is the smallest useful settings file, a plain value plus one table:
title = "Site"
[owner]
name = "Ana"
The conversion produces:
{
"title": "Site",
"owner": {
"name": "Ana"
}
}
Two things happened, and both are typical. The top-level pair, title = "Site", became a top-level JSON key with the same value. The [owner] header became a nested object: the keys under it now sit inside "owner". Nothing was renamed, nothing reordered, no value changed type. A bigger file behaves the same way, just with more nesting.
Reading the nested JSON output
JSON output looks denser than the TOML it came from, so read it by structure rather than line by line. Every table header in the original corresponds to one nested object in the output, named after the header. Every repeated array-of-tables header corresponds to one array of objects. Keys that were dotted in the TOML, like server.host, appear as genuinely nested objects, which is what the dots always meant.
Spot-check three things before you trust a conversion. First, compare the top-level keys with the top-level keys and table headers in the TOML. Second, pick one value from deep inside a table and find it at the same depth in the JSON. Third, check any dates: present, quoted as strings, in the same written form. If those pass, the file has crossed over correctly.
When the conversion stops: the line number is the clue
A stopped conversion is not a failed file; it is a located problem. The parser reads until it meets something outside its supported subset, stops there, and reports the line number. That design is deliberate: the alternative, skipping the unparseable part and emitting the rest, would give you a file that looks complete and is not, which is far worse.
So when it happens, open the original TOML, go to the named line, and look at what it does. Usually it is a single construct the subset does not cover. Rewrite it in a simpler form the subset accepts, for example by expanding an unusual construct into plain keys and tables, then paste the whole file and convert again. With no partial output, there is nothing stale to delete.
Limitations and honest tradeoffs
The converter goes one way only, TOML to JSON. If you later need TOML again, go back to your original file rather than looking for a reverse conversion, because the JSON copy has already lost the comments and the layout.
The supported subset is broad but not the whole TOML language. Files that lean on unusual corners of the specification may stop the conversion until the offending line is simplified. Dates and times, as covered above, become strings, and very large integers and the inf and nan values also become strings by design. And a successful conversion only proves the JSON matches the TOML; it says nothing about whether the receiving tool will accept every value, which is that tool's own rules.
Common mistakes
- Pasting JSON into the converter. The input must be TOML. JSON pasted here will stop the parser almost immediately, and the line number will point at the first line, which is the clue.
- Pasting only part of the file. Without the table headers, keys land at the wrong level. Always convert the whole file at once.
- Ignoring the line number in an error. It is the most useful part of the message. Go straight to that line instead of re-checking the whole file.
- Deleting the TOML after converting. The JSON has no comments and is painful to edit. The TOML stays your source of truth.
- Assuming a string output for a huge number is a bug. It is the converter refusing to round your value. Keep it as a string, or reduce the value in the original.
FAQs
What TOML can the converter handle? Key-value pairs, dotted and quoted keys, table and array-of-tables headers, basic, literal and multiline strings, integers in decimal, hex, octal and binary, floats, booleans, arrays, inline tables, and dates and times, which are kept as strings. Anything outside that subset stops the conversion with an error.
The conversion stopped with an error. What do I do? Read the line number in the error and look at that line in your original TOML file. Something on it sits outside the supported subset. Simplify or rewrite that line, paste the file again, and convert once more. There is no partial output to clean up.
Will my dates and comments survive the conversion? Dates survive as strings in the same written form, because JSON has no date type. Comments do not survive at all, because JSON has no comment syntax. Keep the TOML file as your documented original and treat the JSON as a generated copy.
Why did a very large number come out as a string? Integers too large to represent exactly, and the special values inf and nan, are kept as their original digit strings. That is deliberate: a visibly different string is safer than a number that was silently rounded to a slightly wrong value.
Is my settings file uploaded to a server? No. A parser runs inside your browser and the file never leaves your device. You can disconnect from the internet after the page loads and the conversion still works.
Conclusion
Converting a TOML settings file to JSON is a paste, a click and a short read-through, provided you know the two honest losses in advance: dates become strings and comments disappear. When the converter stops, it tells you the exact line, which turns a potential afternoon of guessing into a one-line fix. The companion guide, TOML vs JSON for Config Files: What Changes, goes deeper on each difference between the two formats. For more in this series, see the Data and JSON Tools guides.
References
- TOML specification, on tables, arrays of tables and datetimes: https://toml.io/en/v1.0.0
- JSON specification, on the values JSON can represent: https://www.json.org/json-en.html