JSON to TOML Converter

JSON Input
1
TOML Output

Last updated:

Jsonic's JSON to TOML converter transforms JSON objects into TOML configuration format. Nested objects become TOML [tables]. Arrays of objects become TOML [[array tables]]. TOML does not support null values — the converter returns a clear error if null fields are present. The root must be an object, not an array. Output can be copied or downloaded as a .toml file.

How JSON to TOML conversion works

TOML is a configuration format built for humans to read and edit. The mapping from JSON follows a few rules: flat key-value pairs stay as-is, nested objects become [table] sections, arrays of objects become [[array-of-tables]] blocks, and primitive arrays stay inline. A flat JSON object converts almost one-to-one.

{
  "name": "jsonic",
  "version": "1.0.0",
  "private": true,
  "retries": 3
}
name = "jsonic"
version = "1.0.0"
private = true
retries = 3

Nested objects become TOML tables

A nested JSON object becomes a TOML table declared with a [header] on its own line, followed by its key-value pairs. Deeper nesting uses dotted headers like [server.database]. A short object used as a value can also be written as an inline table on one line: server = {host = "localhost", port = 8080}.

{
  "server": {
    "host": "localhost",
    "port": 8080
  },
  "database": {
    "poolSize": 10
  }
}
[server]
host = "localhost"
port = 8080

[database]
poolSize = 10

Arrays of objects become array tables

JSON arrays that contain objects map to TOML array tables, written with the double-bracket header [[name]]. Each [[name]] block adds one more object to the array — ideal for plugin lists, server instances, or route definitions that repeat.

{
  "plugins": [
    { "name": "auth", "enabled": true },
    { "name": "billing", "enabled": false }
  ]
}
[[plugins]]
name = "auth"
enabled = true

[[plugins]]
name = "billing"
enabled = false

Types, dates, and null limitations

TOML supports strings, integers, floats, booleans, datetimes, arrays, and tables. A date held as a JSON string can be promoted to a real TOML datetime (no quotes). The two things that do not survive: JSON null (no TOML type) and mixed-type arrays, which TOML rejects because every element of an array must share one type. Drop or replace nulls before converting.

{
  "created": "2026-06-17T09:30:00Z",
  "tags": ["a", "b", "c"],
  "theme": null
}
# null dropped; date becomes a real TOML datetime
created = 2026-06-17T09:30:00Z
tags = ["a", "b", "c"]

Convert JSON to TOML in code

When you need conversion in a script or build step instead of the browser tool:

# Python — tomli-w (write-only). Strip nulls first; TOML has no null.
import json, tomli_w
data = json.loads(open("data.json").read())
print(tomli_w.dumps(data))
// Node.js — @iarna/toml. Root must be an object (a TOML table).
const TOML = require('@iarna/toml')
const data = require('./data.json')
console.log(TOML.stringify(data))

When JSON to TOML works best (and common mistakes)

TOML suits config-like JSON: an object at the root, nested objects as sections, arrays of similarly shaped objects, no null values, and output meant to be edited by humans. It is the wrong target for arbitrary API payloads.

  • Trying to convert a root JSON array — wrap it under a key first.
  • Leaving null values in the input (TOML has no null).
  • Using mixed-type arrays like [1, "two", true], which TOML rejects.
  • Expecting TOML to preserve JSON object key order as business logic.

For a step-by-step walkthrough with the full type-mapping table, see the JSON to TOML tutorial. For a similar human-friendly config format, try JSON to YAML.

How to convert JSON to TOML

  1. Paste your JSON object into the left panel.
  2. Click Convert.
  3. Nested objects become TOML [tables].
  4. Arrays of objects become [[array tables]].
  5. Click Copy or Download to save the .toml file.

FAQ

How are nested objects converted?

Nested objects become TOML tables using [section.subsection] notation.

How are arrays of objects converted?

Arrays of objects become TOML array tables using [[section]] syntax.

Is my data sent to a server?

No. Conversion runs entirely in your browser.

What is TOML used for?

TOML is a configuration file format used by Rust projects (Cargo.toml), Python packaging (pyproject.toml), Hugo sites, and many other tools. It is designed to be more readable than JSON for config use cases.

Can TOML represent all JSON types?

Almost. TOML supports strings, integers, floats, booleans, datetime, arrays, and tables. JSON null has no TOML equivalent and will cause an error.

What if my JSON contains null values?

TOML does not support null. Remove null values from your JSON before converting, or replace them with an appropriate default.

Can I convert TOML back to JSON?

Not in this tool. TOML-to-JSON conversion is not currently supported.