JSON to TOML converter

Handy for building pyproject.toml, Cargo.toml or Hugo settings from JSON data. It shows how many null values were left out.

Loading the tool…

Processing and privacy: The result is calculated inside your browser and your data is not sent to any server.

How to use it

  1. Enter json text and null values.
  2. The result appears straight away and updates as you edit.
  3. Copy the result, or copy a link that keeps the same values to share it.

How it is calculated

Plain values of each object are written first as "key = value", then nested objects become [a.b] tables and arrays whose items are all objects become [[a]]. Strings use double quotes with escapes, multi-line text uses """, and keys with spaces or dots are quoted.

Example

Inputs: Null values = Leave them out. Result: TOML: app = "toolsahla" version = "2.1.0" port = 8080 debug = false languages = ["ar", "en"] [database] host = "localhost" user = "admin" timeout = 30 ; Null values left out: 0.

{
  "app": "toolsahla",
  "version": "2.1.0",
  "port": 8080,
  "debug": false,
  "languages": ["ar", "en"],
  "database": {
    "host": "localhost",
    "user": "admin",
    "timeout": 30
  }
}
app = "toolsahla"
version = "2.1.0"
port = 8080
debug = false
languages = ["ar", "en"]

[database]
host = "localhost"
user = "admin"
timeout = 30

Limits and caveats

  • The top level of the JSON must be an object { } because a TOML file is a table.
  • Dates in JSON are written as quoted strings, since JSON does not mark them as dates.

Questions about this tool

Why did some values disappear?

TOML has no null. By default they are left out and counted; you can write them as empty strings or show an error instead.

When does [[name]] appear?

When an array holds only objects, each item is written as its own table under a [[name]] header.

Does it handle large integers?

Yes, within the 64-bit range TOML sets for integers. Anything larger gives an error.