TOML is where configuration lives: readable, comment-friendly, and easy to edit by hand. JSON is where data has to go: APIs expect it, apps import it, and half the tooling in a modern stack speaks nothing else. Sooner or later a file written for humans has to be handed to a system that wants JSON, and retyping it by hand is slow and error-prone.
The TOML to JSON Converter on Ovatly does that translation in your browser. This guide explains what it accepts, how TOML structure maps onto JSON structure, and what happens when a file contains something outside the supported subset.
Contents
- Quick answer
- One direction only, on purpose
- How TOML structure becomes JSON structure
- The supported subset
- How to convert TOML to JSON, step by step
- Worked example: a title and an owner table
- When conversion stops: errors that name the line
- Limitations and honest tradeoffs
- Common mistakes
- FAQs
- Conclusion
- References
Quick answer
Open the TOML to JSON Converter, paste your TOML or load the file, and convert: tables and dotted keys become nested JSON objects, arrays of tables become arrays, and dates and times stay as strings. The converter runs one way only, from TOML to JSON, and works through a defined subset of the language. If anything in the file sits outside that subset, the conversion stops and the error names the line number, so you know exactly where to look. Nothing is uploaded; the parsing happens in your browser.
One direction only, on purpose
Many converters promise every direction and quietly mangle the awkward cases in each. This one does a single job: TOML in, JSON out. There is no JSON to TOML mode, and the guide will not pretend otherwise. A single direction keeps the failure behaviour strict: either the whole file converts, or you get an error and no output at all.
If your workflow genuinely needs the reverse direction, use a dedicated tool for the way back. Most real jobs, feeding a config into an API, an importer or a script that reads JSON, only ever travel this way.
How TOML structure becomes JSON structure
The mapping is the part worth understanding, because it is predictable enough to plan around.
A TOML table becomes a JSON object, nested under its name. A section like [owner] in the file appears as an owner object in the output, with its keys inside. An array of tables, written with double brackets such as [[products]], becomes a JSON array of objects, one object per table, in file order. Dotted keys nest as well: a key like server.host builds the same nested object a [server] table would, so the two TOML styles arrive at the same JSON shape.
Scalars map across directly. Strings stay strings, booleans stay booleans, and ordinary integers and floats become JSON numbers. Dates and times are the deliberate exception: they are kept as strings, in the written form they had in the TOML file. JSON has no date type, and a string preserves exactly what the author wrote instead of guessing at a format.
The supported subset
The converter is a careful browser parser, and it is honest about its boundaries. It supports:
- Key and value pairs, including dotted keys and quoted keys.
- Tables, written with
[table], and arrays of tables, written with[[array-of-tables]]. - Basic strings, literal strings and multiline strings.
- Integers in decimal, hexadecimal, octal and binary form.
- Floats, and booleans.
- Arrays, and inline tables.
- Dates and times, which are kept as strings.
Two value rules deserve a mention. Oversized integers that would lose precision as JSON numbers are kept as their original digit strings, and the special float values inf and nan are likewise kept as their original digit strings rather than being dropped or silently changed. The principle is consistent: preserve the exact value, even when JSON cannot represent it natively.
Anything outside this subset is not converted. That is not a flaw in the workflow; it is the workflow, and the next sections show how the error reporting makes it painless.
How to convert TOML to JSON, step by step
- Open the TOML to JSON Converter.
- Paste your TOML text, or load the
.tomlfile from your device. - Convert, and read the JSON output: check that tables nested where you expected and that arrays of tables came out as arrays.
- If the conversion stops, note the line number in the error, look at that line in your source, fix the syntax or simplify the construct, and convert again.
- Copy the JSON or download it for the system that needs it.
Worked example: a title and an owner table
Take this small TOML configuration:
title = "Site"
[owner]
name = "Ana"
Converting it produces this JSON:
{
"title": "Site",
"owner": {
"name": "Ana"
}
}
The plain key stays at the top level, and the [owner] table becomes a nested owner object holding its own keys. Every TOML file you convert follows the same pattern at larger scale: top-level keys at the top, one nested object per table, one array per array of tables.
When conversion stops: errors that name the line
Sooner or later a file will contain a construct outside the subset, a syntax slip, or a value the parser does not handle. When that happens, the conversion stops entirely and the error names the line number of the problem. No partial output is produced.
That strictness is worth more than it first appears. A partial conversion is a trap: the JSON looks complete, loads without complaint, and quietly drops the settings that came after the problem. An error with a line number sends you to the exact place in a file that might be hundreds of lines long, and the fix is usually a thirty-second edit. Treat the line number as the feature, not the failure.
Limitations and honest tradeoffs
The subset is the main limit. Full TOML is a rich language, and files that lean on its more exotic corners may stop the conversion until the offending construct is rewritten in a supported form. The line-numbered errors make that practical, but expect the step on complex files.
The converter also keeps dates, oversized integers and inf or nan as strings, which is faithful but means the receiving system sees text where it might expect numbers; check what your importer wants for those fields. Finally, comments and formatting do not survive: JSON has no comments, so annotations stay behind in the source. Keep the TOML file as the documented original and treat the JSON as the delivery copy.
Common mistakes
- Expecting a JSON to TOML mode. There is none. The converter runs in one direction only.
- Hunting through the file after an error. The error names the line number. Go straight there instead of re-reading from the top.
- Assuming a date became a timestamp. Dates and times are kept as strings in their written form. If your system needs a different format, convert deliberately on that side.
- Losing precision worries in the wrong place. Oversized integers are preserved as digit strings precisely so they are not rounded. Check how your importer treats them.
- Editing the JSON and forgetting the source. The TOML file holds the comments and the readable structure. Edit there, then convert again.
FAQs
Can the converter turn JSON back into TOML? No. It runs in one direction only, TOML to JSON. If you need the reverse, you will need a different tool; this one is deliberately a single, careful conversion.
What happens to dates and times in my TOML file? They are kept as strings in the JSON output, in the same written form as the TOML source. Nothing is converted to a timestamp number or reformatted, so the value you read is the value you wrote.
Why did my conversion stop with an error? Something in the file sits outside the supported subset. The error names the line number, so go to that line, check the syntax there, and convert again. No partial output is produced, so you never get a half-converted file.
What happens to very large integers, or values like inf and nan? They are kept as their original digit strings rather than being forced into a JSON number. That preserves the exact value instead of letting it be rounded or rejected.
Is my configuration file uploaded to a server? No. The conversion runs in your browser and the file never leaves your device, which matters because configuration files often contain paths, names and settings you would rather keep local.
Conclusion
Converting TOML to JSON is a small job that deserves a careful tool: one that maps tables and dotted keys into clean nested objects, keeps dates and oversized numbers exact as strings, and refuses to guess when it meets something outside its subset. The TOML to JSON Converter does exactly that, in your browser, with errors that point at the line to fix. If your data arrives as printed terminal output rather than a config file, our companion guide on exporting SQL query results to CSV covers that rescue job. For more in this series, see the Data and JSON Tools guides.
References
- TOML specification, the language the source files are written in: https://toml.io/en/v1.0.0
- JSON specification, the format the output is written in: https://www.json.org/json-en.html