A config file in TOML is easy to read and pleasant to edit. Then a tool, a script or a teammate asks for the same settings as JSON, and the question lands: if I convert this, what actually changes? Some differences are pure costume, the same value in different punctuation. Others are real losses, because JSON has fewer kinds of things it can hold.
This guide walks through the conversion honestly, using the free TOML to JSON Converter on Ovatly. By the end you will know which values cross over untouched, which change their nature, and which do not survive the trip.
Contents
- Quick answer
- What only changes clothes
- Tables become nested objects
- Dates and times become strings
- Comments do not survive
- Integers in other bases become plain numbers
- How to convert, step by step
- Worked example: a small settings file
- Limitations and honest tradeoffs
- Common mistakes
- FAQs
- Conclusion
- References
Quick answer
Converting TOML to JSON with the TOML to JSON Converter keeps your data intact in most respects: strings, floats, booleans and arrays come out the same, and key-value pairs stay key-value pairs. Four things genuinely change. Tables become nested objects. Dates and times become plain strings, because JSON has no date type. Comments vanish, because JSON has no comments. Integers written in hex, octal or binary come out as ordinary decimal numbers. The conversion runs in one direction only, and it happens entirely in your browser.
What only changes clothes
Start with the reassuring part. A TOML line like port = 8080 becomes "port": 8080 in JSON: same key, same number, a colon instead of an equals sign and quotes around the key. A string stays a string, whether it was written as a basic, literal or multiline string. A float like 3.14 stays 3.14. Booleans stay true and false. Arrays stay arrays, in the same order, with the same items.
Dotted keys, a TOML convenience where server.host builds nested structure without a table header, also cross over cleanly: the dots become real nesting in the JSON object. Inline tables, written in braces on one line, become small nested objects. None of this changes the meaning, which is why converting config between the formats is usually safe for the values themselves.
Tables become nested objects
The structural change is tables. TOML gives config files their tidy look with table headers: a line like [owner] says every key below it belongs to a group called owner. JSON has no headers, so the group becomes a nested object instead: an "owner" key whose value is an object holding those keys. The information is identical; a section heading is traded for a pair of braces.
Arrays of tables change the same way. A repeated header like [[products]] becomes one "products" key holding an array of objects, one per repeated table. If you wonder where the tidy sections went, they are all still there, nested one level deeper.
Dates and times become strings
This is the change with real consequences. TOML has strong date and time types: a value like 1979-05-27 is a genuine date, and a datetime with an offset is a genuine point in time. JSON has no date type at all. Its complete list of types is string, number, boolean, object, array and null.
So the converter keeps dates and times as strings, written exactly as they appeared. Nothing is reformatted, but the type is gone: a program reading the JSON sees text, and has to parse the date itself. If the receiving system expects real dates, check how it treats date-shaped strings; the conversion will not flag them.
Comments do not survive
TOML files are usually full of comments, the # notes that explain why a setting has its value. JSON has no comment syntax whatsoever, so comments have nowhere to go and are dropped in conversion.
For most conversions this is fine, because the JSON copy is usually machine-read output, not the file a human maintains. But if a comment carries a warning the next person needs, it will not be in the JSON. Keep the TOML file as the commented source of truth, treat the JSON as a generated copy, and move any vital note into a string value of its own before converting.
Integers in other bases become plain numbers
TOML lets you write integers in the base that suits the value: hexadecimal with a 0x prefix, octal with 0o, binary with 0b. JSON numbers are decimal only, so these come out as ordinary decimal numbers with the same value. A hex value keeps its meaning and loses its costume.
Two edge cases are handled conservatively. An integer too large for exact representation is kept as its original digit string rather than rounded into a slightly wrong number, and the same goes for inf and nan, which JSON cannot express as numbers. They arrive as strings, visibly different, instead of silently corrupted.
How to convert, step by step
- Open the TOML to JSON Converter and paste your TOML into the input box.
- Run the conversion and read the nested JSON in the output.
- If the conversion stops, read the error: it names the exact line number, so you can find and fix that line in the original file.
- Copy the JSON to wherever it is needed, and keep the TOML original as your editable source.
Worked example: a small settings file
Take a minimal settings file with a plain value and one table:
title = "Site"
[owner]
name = "Ana"
Converted, it becomes:
{
"title": "Site",
"owner": {
"name": "Ana"
}
}
The whole story of this guide is in those two blocks. The strings are untouched. The [owner] header has become a nested object, a change of clothes, not of content. Had the file carried a date, it would appear in the JSON as a quoted string, and any # comments would be gone entirely.
Limitations and honest tradeoffs
The converter works in one direction only: TOML to JSON. There is no reverse path in this tool, and a round trip would lose comments and formatting anyway.
It is also a careful parser for a defined subset of TOML: key-value pairs, dotted and quoted keys, table and array-of-tables headers, the string forms, integers in the common bases, floats, booleans, arrays, inline tables, and dates and times kept as strings. Anything outside that subset stops the conversion with a line-numbered error and no partial output, which is safer than a quietly incomplete conversion.
Finally, conversion cannot add meaning. If the receiving system wanted real dates, typed values or your explanatory comments, the JSON alone will not supply them, no matter which converter you use.
Common mistakes
- Expecting the JSON to keep your comments. It cannot; JSON has no comments. Keep the TOML as the documented original.
- Assuming dates are still dates. They are strings now. Check what the receiving program does with them.
- Treating a stopped conversion as a broken file. The error names the line. Usually one line uses something outside the supported subset, and fixing that line is enough.
- Editing the JSON and throwing away the TOML. The JSON is the awkward one to maintain by hand. Edit the TOML, convert again.
- Worrying that hex values broke. They did not; they are the same numbers written in decimal.
FAQs
Can I convert JSON back to TOML with the same tool? No. The TOML to JSON Converter works in one direction only, from TOML to JSON. Converting back would be lossy too: the comments and layout of your TOML file are gone once converted.
Do my TOML dates stay dates in the JSON output? They stay readable, but not as dates. JSON has no date type, so the converter keeps dates and times as strings in the same written form. Any program reading the JSON has to parse that string itself if it needs a real date.
What happens to the comments in my TOML file? They are dropped. JSON has no comment syntax, so there is nowhere for them to go. If a comment carries information you need, copy it into a string value of its own before converting, under a key like "notes".
What if my TOML file uses a feature the converter does not support? The conversion stops and the error names the line number where it stopped. There is no partial output, so you never get a half-converted file that looks complete. Fix that line and convert again.
Is my config file uploaded anywhere? No. The converter runs a parser inside your browser and the file never leaves your device. That matters for config files, which often hold paths, names and settings you would rather keep local.
Conclusion
TOML to JSON is mostly painless: the values survive, the structure nests, and the honest losses are dates becoming strings and comments disappearing. Knowing those two in advance makes the difference between a smooth handover and a confused afternoon. The companion guide, How to Convert a TOML Settings File to JSON, walks the practical conversion itself, including what to do when the converter stops on a line. For more in this series, see the Data and JSON Tools guides.
References
- TOML specification, on tables, datetimes and integer bases: https://toml.io/en/v1.0.0
- JSON specification, on the six types JSON can hold: https://www.json.org/json-en.html