TOML to JSON Converter

Put a TOML settings file in, and take the same settings out as JSON for a program that only reads JSON.

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 happens to a TOML date in JSON?

In TOML a date written without quotes is a date, not text. JSON has no dates, so the converter writes it as text in ISO form.

From TOML to JSON
  1. Read the TOML and check every date is a real one
  2. Write each date and time as text in ISO form
  3. Write the settings out as JSON

What it does

1.0 comes out as 1

JSON has a single kind of number, so a TOML decimal with nothing after the point loses its .0.

Tables become objects

[menu] and the lines under it become one object called menu, inside the main one. An object is JSON's braces-wrapped group of names and values.

Impossible dates caught

A date that doesn't exist, such as the 30th of February, stops it with "This TOML calendar date does not exist."

Limits Whole numbers past 9,223,372,036,854,775,807 stop it, because TOML itself has no integer that large.

A website's settings with the day the shop opened

Many small websites are built from a settings file, and the bakery's is written in TOML: lines of name = value, grouped under headings in square brackets that TOML calls tables. One of the settings is the day the shop opened, which the site prints in its footer.

You need the same settings as JSON for another tool, so you paste the file in. The opening day comes out as text in quotes, and the status line says: "Dates and times were written as text, in the form TOML gives them."

A date in TOML is more than text that looks like one

Written without quotes, the opening day in that file isn't a few characters that happen to look like a date. It is a date: TOML has kinds of value for a date, a time of day, or both. A program reading the file gets a real date it can count days from.

JSON has text, numbers, true, false, null, lists and objects, and nothing for dates. So the converter writes the date as text, in ISO form, and leaves the program on the other end to read it.

Putting the date in quotes in the TOML gives the same JSON:

A TOML dateopened = 2019-04-06"opened": "2019-04-06",The same date as textopened = "2019-04-06""opened": "2019-04-06"

Date or text

Quoted or not, the JSON gets the same ten characters. How we checked

Times work the same way. opens = 07:30:00 under a [hours] table comes out as "07:30:00.000". A time finer than a millisecond stops the run instead, because writing it would lose digits.

Converting the file

  1. Paste the settings file into the TOML box.

  2. Tap or click anywhere outside the box. The status line says dates and times were written as text.

  3. Look at the date of the setting named opened in the JSON. It is text in quotes.

  4. On a phone, switch to the Result tab to see the JSON.

  5. Press Copy to put the JSON on your clipboard.

Ours has the date on line 3. If the program reading the JSON wants a number or a different date layout, change it there; the converter writes ISO form, and a time gets milliseconds.

Later you'll need the JSON back as TOML

JSON to TOML Converter

The date goes back in quotes, as text, not as a TOML date.

You'd rather keep the TOML and only tidy it

JSON formatter, with TOML chosen

Choose TOML under Language and Format under Do. The layout is evened out; dates stay unquoted dates, and comments are removed.

Search FluffyBench