jsonecho

JSON5 Formatter

Paste JSON5, with its comments and relaxed syntax, and get clean, standard JSON back.

Loading the tool...

How to use JSON5 Formatter

  1. Paste your JSON5 into the input box.
  2. Choose an indent and decide whether the output should stay JSON5.
  3. Copy the standard JSON from the right side.

About JSON5 Formatter

JSON5 is what JSON would look like if it was designed for humans to write. You can add comments, use single quotes, leave keys unquoted, put a comma after the last item and write numbers in hex. Config files for tools such as Babel and Chrome extensions use it for exactly that reason.

The catch is that most JSON parsers reject all of it. This tool reads JSON5 and writes strict JSON, so the result is accepted anywhere. You can also keep the output in JSON5 if you prefer.

Frequently asked questions

What does JSON5 allow that JSON does not?

Comments, trailing commas, single-quoted strings, unquoted keys that are valid identifiers, hex numbers, leading or trailing decimal points, Infinity and NaN, and multi-line strings.

Are comments kept in the converted output?

No. Strict JSON has no way to store comments, so they are dropped during conversion.

Is JSON5 the same as JSONC?

Not quite. JSONC, used by VS Code settings, only adds comments and trailing commas. Everything JSONC allows is valid JSON5, so you can paste a JSONC file here too.

When should I use JSON5 myself?

For files that people edit by hand and that your own code reads, such as configuration. For data exchanged with other systems, use plain JSON.

More in JSON Tools

All tools →