consolelog.tools

TOML to JSON

Convert TOML to JSON live — configurable indentation and key stats, with a clear error for malformed input.

About this ToolHow it works, benefits & use cases

TOML to JSON parses a TOML configuration document and emits the equivalent JSON. Paste TOML — including [table] headers, [[array-of-tables]] blocks, inline tables, typed values, and dates — and the tool uses the @iarna/toml parser to build a data structure and serialize it as JSON, live as you type. You control whether the JSON is indented with 2 or 4 spaces. Because TOML's typed values and table syntax can be easy to get subtly wrong, malformed input produces a clear error message describing what the parser rejected, rather than failing silently. A footer reports how many keys the document contains and how many lines the JSON output spans, and you can copy the result or download it as a .json file. It is the inverse of the JSON to TOML tool and shares the same engine. Everything runs locally in your browser and is free to use.

How to Use

  1. 1Paste your TOML into the input panel, or click "Load example" for a sample document with tables and an array of tables.
  2. 2Pick the JSON indentation in Options: 2 spaces or 4 spaces.
  3. 3The JSON output renders live as you type; click "Convert to JSON" to confirm.
  4. 4If the TOML is malformed, read the inline error explaining what the parser rejected.
  5. 5Copy the JSON or download it as output.json; the footer shows the key and line counts.

Key Benefits

  • Parses full TOML: tables, arrays of tables, inline tables, and typed values
  • Choice of 2-space or 4-space JSON indentation
  • Live conversion updates as you type
  • Clear error message for malformed TOML instead of silent failure
  • Preserves TOML types — numbers, booleans, and dates carry through correctly
  • Key count and output line count shown in the footer
  • Copy or download as .json; runs entirely in-browser with no upload

Common Use Cases

  • Inspecting a Cargo.toml or pyproject.toml as JSON for a script or tool that expects JSON
  • Converting a TOML config so it can be consumed by a JavaScript application
  • Validating that a TOML file parses cleanly before deploying it
  • Generating a JSON fixture from an existing TOML configuration
  • Comparing the same settings expressed in TOML and JSON side by side

Options

0 characters · live

Paste TOML above to see the JSON live.

Was this tool helpful?

Share Your Experience

Help others discover this tool!

Related tools