>_devtools

JSON to TOML Converter

Convert a JSON object to TOML with correct tables and arrays of tables, and a clear policy for null values.

What this does

Converts a JSON object into a TOML 1.0 document. Scalars at the top level are written first, nested objects become [table] sections, and arrays of objects become[[array of tables]]. Keys that are not valid bare keys are quoted automatically.

Example

Input

{
  "id": 42,
  "name": "Ada",
  "verified": true,
  "tags": [
    "admin",
    "dev"
  ],
  "orders": [
    {
      "sku": "A1",
      "qty": 2
    },
    {
      "sku": "B2",
      "qty": 1,
      "note": "gift"
    }
  ]
}

Output with default options

id = 42
name = "Ada"
verified = true
tags = [ "admin", "dev" ]

[[orders]]
sku = "A1"
qty = 2

[[orders]]
sku = "B2"
qty = 1
note = "gift"

Limits of TOML

  • The JSON root must be an object, because a TOML document is a table of keys. A root array or scalar is reported as an error rather than wrapped silently.
  • TOML has no null. By default null values (and null array items) are omitted and the tool tells you how many were dropped and where; choose Report as errorto stop at the first one and see its JSON path.
  • Whole numbers are written as TOML integers and numbers with a fractional part as floats. JSON does not distinguish 1 from 1.0, so a float that happens to be whole becomes an integer.

Privacy

The conversion runs in your browser. The JSON is never uploaded.