JSON to TOML Converter

Turn JSON settings in braces into TOML's plain name = value lines, nested groups and lists included.

FluffyShield Protected workspace
FluffyShield

Isolated workspace: other page scripts can't read your files. How FluffyShield works

Free · No upload · No sign-up · No usage quotas

What should a null become in TOML?

Nothing at all. TOML can't write an empty setting, so the setting has to go, and the converter stops at each null until it has.

From JSON to TOML
  1. Check the JSON is one set of braces with no null in it
  2. Write each setting as a name = value line
  3. Turn each nested group into a [heading] of its own

What it does

Plain settings move up

A setting that came after a nested object in the JSON is written above that object's table, so TOML doesn't count it as part of the table.

Lists of groups

A list of groups in braces becomes a run of headings written [[name]], one for each group.

Limits One set of braces at the top only: a list on its own is refused.

Order-app settings with two blanks in them

Orders at the bakery come in through an app that exports its settings as JSON, but the program that prints kitchen tickets wants them as TOML, a settings format of plain name = value lines. Two settings were never filled in: the proxy, a go-between computer that some office networks send web traffic through, and the user name for the mail server. JSON writes a setting with no value as null.

Paste the export, and the converter stops before writing a line: "$["proxy"]: TOML has no null value. Remove or replace it explicitly before converting."

TOML has no word for nothing

The TOML specification lists what a setting can hold: text, numbers, true or false, dates and times, lists and tables. There's no empty value, and it says outright that a setting with no value is invalid. A TOML file says a setting isn't set by leaving it out.

So the faithful way to carry "proxy": null across is to delete the line. Two shortcuts look tidier and say something else. proxy = "" is a setting, a piece of text with nothing in it, and a program may still try to use it as an address. proxy = "none" is a proxy called none. How a program treats a setting that isn't there is up to the program, so if yours lists its settings somewhere, check what it does without this one.

The mail settings, which sit in their own braces in the JSON, go under [mail] in the TOML: a heading in square brackets that groups the lines under it, which TOML calls a table.

The JSON export{"app": "bakery-orders","proxy": null,"mail": {"host": "smtp.example.com","user": null},"port": 8080}The TOML, nulls taken outapp = "bakery-orders"port = 8080[mail]host = "smtp.example.com"

Export, then TOML

With both null lines deleted, the TOML has no proxy and no mail user at all. How we checked

Clearing the nulls, one message at a time

  1. Paste the exported settings into the JSON box.

  2. Leave the box by tapping or clicking beside it, and read which setting the message under it names.

    The message under the JSON box: Line 1, character 1, then $["proxy"]: TOML has no null value, and to remove or replace it.
    The message under the JSON box: Line 1, character 1, then $["proxy"]: TOML has no null value, and to remove or replace it.
  3. Delete that setting's whole line, here the one that reads "proxy": null.

  4. Do the same for each setting the next message names, until the TOML box fills.

With the proxy line gone, ours stopped again at $["mail"]["user"], the user setting inside mail.

Deleting the last setting inside a pair of braces leaves a comma behind on the line above it, here the comma after "host": "smtp.example.com". Strict JSON doesn't allow a comma before a closing brace, so take that comma out too, or the next message will point at the brace on line 5 instead.

You want to check what the TOML holds

TOML to JSON Converter

Paste the TOML there. The proxy and the mail user aren't in the JSON either; they don't come back as null.

The export arrived as one long line

JSON formatter

Format JSON puts each setting on a line of its own, so every null is a line you can delete.

Search FluffyBench