Skip to content

TOML to JSON Converter

Parse TOML documents and convert to formatted JSON output with validation and error reporting.

TOML to JSON Converter tool

Loading...

Example

Input: title = "App" / [server] / port = 8080

Result: A 2-space indented JSON object: { "title": "App", "server": { "port": 8080 } }

The [server] table becomes a nested object. Integers and booleans keep their types, and TOML dates become ISO date strings.

How TOML Values Appear in JSON

TOMLJSON
a = "x"{"a": "x"}
a = 'C:\path'{"a": "C:\\path"}
a = 1_000{"a": 1000}
a = 0x1F{"a": 31}
a = inf{"a": null}
a = 2024-01-15T10:30:00Z{"a": "2024-01-15T10:30:00.000Z"}
a = 2024-01-15T10:30:00{"a": "2024-01-15T10:30:00.000"}
a = 2024-01-15{"a": "2024-01-15"}
a = 10:30:00{"a": "10:30:00.000"}
a = { b = 1 }{"a": {"b": 1}}
a.b = 1{"a": {"b": 1}}
[[a]] then b = 1{"a": [{"b": 1}]}

Output of this converter.

  1. Paste your TOML configuration content into the input area on the left side.
  2. The parser validates TOML syntax and reports any errors such as duplicate keys or malformed values.
  3. Review the converted JSON output with proper indentation and type mapping in the right panel.
  4. Verify that TOML tables, arrays of tables, and datetime values are correctly represented in JSON.
  5. Click the copy button to copy the formatted JSON for programmatic processing or API consumption.

Reading TOML Files as JSON

This tool parses a TOML file and prints the same data as JSON with 2-space indentation. A [server] section holding port = 8080 becomes "server": { "port": 8080 }, ready for a script, an API or a JSON Schema check. The parser follows TOML 1.0 and is strict. Duplicate keys, a table defined twice or a badly written value stop the conversion with an error message. Comments are dropped. Dotted keys like a.b = 1, inline tables like a = { b = 1 } and [[array]] tables all become nested JSON objects and arrays.

TOML has more types than JSON, so a few values change form. Integers written as 1_000 or 0x1F become plain numbers, 1000 and 31. Dates and times become strings. An offset date-time gets milliseconds added, so 2024-01-15T10:30:00Z becomes "2024-01-15T10:30:00.000Z". A local date stays "2024-01-15", and a local time such as 10:30:00 becomes "10:30:00.000". The special floats inf and nan have no JSON form and come out as null. The table lists each case.

The conversion also runs the other way, from JSON back to TOML. To move the config into a YAML-based tool instead, use the TOML to YAML Converter, and to explore the JSON as a tree, the JSON Formatter.

Sources

Frequently Asked Questions

JSON has no date type, so dates and times become strings in ISO 8601 form. Offset date-times are written in UTC with milliseconds, local date-times and local times get milliseconds added, and local dates stay as written. Your code then parses the string, for example with new Date() in JavaScript.
TOML does not allow the same key or table to be defined twice. The message appears when a key is repeated, when [server] appears two times, or when a dotted key clashes with a table. Merge the two definitions into one, or use [[server]] if you meant a list of tables.
No. JSON has no comment syntax, so every # comment is dropped during conversion. The data values and structure are kept. If the comments hold useful notes, keep the original TOML file as the source and treat the JSON as generated output.
Yes. An inline table such as point = { x = 1, y = 2 } and dotted keys such as point.x = 1 both become the nested object "point": {"x": 1}. Arrays of tables written with [[name]] become JSON arrays of objects, in the same order as in the file.
TOML allows the special floats inf, -inf and nan, but JSON has no way to write them, so the standard JSON writer outputs null. If your data uses them, handle those fields separately or store them as strings in the TOML.

Related Tools

JSON to TOML Converter

Convert JSON objects to TOML format with type preservation and clean table structure output.

Developer Tools

JSON Formatter and Validator

Format, validate, beautify, and minify JSON data with a collapsible tree view and line-and-column error detection.

Developer Tools

TOML to YAML Converter

Convert TOML configuration files to YAML format seamlessly with structure preservation.

Developer Tools

YAML to JSON Converter

Parse YAML documents and convert to formatted JSON with error reporting and syntax validation.

Developer Tools

JSON to CSV Converter

Convert a JSON array of objects to CSV with automatic column headers, and convert CSV back to JSON in the same tool.

Developer Tools

XML to JSON Converter

Parse XML documents and convert to structured JSON, with attributes kept as @_-prefixed keys and well-formedness checks.

Developer Tools