فارسی

Convert TOML to JSON or YAML and Back

Open a TOML configuration file and convert it to JSON or YAML. To go the other way, enter JSON or YAML and download the TOML file.

Use this tool in your browser without installing software.

About this tool

For example, a TOML [server] table with port = 8080 becomes a JSON object named server with a numeric port field. You can also convert JSON or YAML to TOML. The converter drops TOML comments and writes TOML dates as strings. Keep the original file if its comments or date types matter to your application.

How to use it

  1. 1

    Paste TOML into the input box, or open a .toml file. Pick the other side from the menu above the boxes: JSON or YAML.

  2. 2

    The result appears as you type. On a syntax error, the line and the technical reason show under the box so you can find the spot.

  3. 3

    Copy the result or download the file. To go back, press “Reverse” and the result becomes the new input.

If the file will not open

  • My TOML file works in the app but fails here.

    A bare key can contain ASCII letters, digits 0–9, hyphens (-) and underscores (_). Quote keys in other scripts and check the line named in the error.

  • A number that starts with a zero is rejected.

    TOML does not allow a leading zero in a number, because 0123 can be misread. If the zero matters (a postcode, a phone number), put the value in quotes.

  • The file is too big to convert.

    Files are limited to 1,000,000 bytes. The text box has a separate limit of 1,000,000 UTF-16 code units; some characters take two units. For larger documents, use a local converter designed for large files.

Frequently asked questions

Where did the comments go?

The converter transfers keys and values, not comments. YAML supports comments, but this tool does not copy them from the TOML input. Keep the original file if you need them.

Why is a date wrapped in quotes?

TOML has a date type; JSON does not. This converter writes a TOML date as a string. If you convert that output back to TOML, it stays a quoted string rather than a date.

Why does null fail?

TOML has no empty value; every key needs a real one. If your JSON has a null somewhere, remove that key or give it a real value.

How is an array of tables written?

An array whose items are all objects is written as [[name]], the shape you see in TOML files. A mixed array stays on one line with an inline table, such as [{ x = 1 }, 2].

Is my file or text stored anywhere?

Conversion runs in your browser. Your input text and file contents are not sent to the server. The YAML library is loaded from this site.