/

TOML to JSON

Processed Client Side

Convert TOML config into JSON and back, in either direction, entirely in your browser.

TOML · 18 lines
18 lines · 229 chars
Length: 229Lines: 18Size: 229 BytesCursor: 1:1
JSON
JSON
jsonLength: 355Lines: 26Size: 355 BytesCursor: 1:1

Bookmark this tool now — skip the search next time you need it.

About TOML to JSON

This tool runs entirely in your browser. Whatever you paste is processed on your own device and is never uploaded, logged, or sent to any server.

The TOML to JSON converter reads a TOML configuration file and gives you the equivalent JSON, or takes JSON and writes it back out as TOML. TOML is what Cargo, pyproject.toml, Hugo, and a long list of CLI tools use for configuration, while JSON is what most code, APIs, and scripts actually want, so this is the bridge between the two. Tables, dotted keys, arrays of tables, inline tables, multi-line strings and arrays, and typed values all convert, and the direction flips with one button that carries the current output across as the new input. Both panes are syntax highlighted and everything runs in your browser.

Key features

  • Bidirectional TOML and JSON conversion, with a swap button that feeds the output back in as the next input
  • Handles tables, dotted keys, arrays of tables, and inline tables
  • Typed values are preserved: integers, floats, booleans, and both basic and literal strings, including the multi-line forms
  • Multi-line arrays, quoted keys, and dotted keys parsed reliably
  • Comments are dropped on the way into JSON, since JSON has nowhere to put them
  • Invalid input is reported with the line that failed rather than a generic error
  • Both panes are syntax highlighted and swap language with the direction
  • Converts as you type, entirely client side, so config files never leave your device

How to use it

  1. Paste TOML into the left pane, or use the direction button first if you are starting from JSON.
  2. Read the converted output on the right, which updates as you type.
  3. Click the direction button to flip between TOML to JSON and JSON to TOML; the current output becomes the new input.
  4. If the badge reads invalid, fix the line named in the message and the output reappears.
  5. Copy the result into your config file or tooling.

Tips & common mistakes

  • Dates and times arrive in JSON as strings, because JSON has no date type. Converting back re-quotes them, so a full round trip turns a TOML datetime into a plain string.
  • Comments are not preserved in either direction. Keep the original file when the comments matter more than the data.
  • When converting JSON to TOML the top level must be an object, since a TOML document is always a table at its root. A bare array or string cannot be represented.
  • JSON null has no TOML equivalent and is written as an empty string. Remove those keys, or give them real values, before converting.
  • An inline table in your JSON may come back as a full table section. The data is identical, only the style differs.
  • The parser covers the common surface of TOML rather than the entire specification, so treat it as a converter rather than a strict validator.
  • Chaining this with the JSON to YAML converter is the quickest way to move a config between all three formats.

Related tools

Browse all 4 Other Converters tools

Frequently asked questions

10

Paste your TOML into the left pane and the JSON appears on the right as you type. Use the direction button to flip to JSON to TOML, which carries the current output across as the new input.

Tables, dotted keys, arrays of tables, inline tables, multi-line arrays, basic and literal strings including their multi-line forms, and typed values such as integers, floats, and booleans. It covers the common surface of real config files rather than the entire specification.

They come across as strings, because JSON has no date type. Converting the JSON back to TOML re-quotes them, so a full round trip turns a TOML datetime into a plain string.

They are dropped. JSON has no comment syntax, so there is nowhere for them to go, and they cannot be recovered on the way back. Keep the original file when the comments matter.

The top level has to be an object, since a TOML document is always a table at its root. A bare array, string, or number has no valid TOML representation and is rejected with a message rather than converted incorrectly.

TOML has no null, so a null in your JSON is written as an empty string. If that is not what you want, remove the key or give it a real value before converting.

The writer emits nested objects as full table sections rather than inline tables. The data is identical and both forms are valid TOML, only the style differs.

No. It is a converter that is deliberately forgiving, so it may accept a file a strict parser would reject. Use it to move data between formats, not to certify that a config is spec-compliant.

It is the config format behind Cargo.toml in Rust, pyproject.toml in Python, Hugo sites, and many command-line tools. It was designed to be obvious to read and to map cleanly onto a hash table, which is exactly why the JSON equivalent is so direct.

No. Parsing and writing both run in your browser, so config files that often contain tokens or connection strings never leave your device.