JSON5 Formatter
Format JSON5 — comments, single quotes, unquoted keys and trailing commas — into strict, indented JSON.
What formatting JSON5 does
The reader accepts the documented subset of JSON5: line and block comments, single-quoted strings, unquoted identifier keys, trailing commas, hexadecimal numbers, a leading plus, a leading or trailing decimal point, Infinity and NaN. The output is strict JSON, so it can go straight into a parser that never heard of JSON5. Two conversions are worth knowing: comments are dropped because JSON has no place to keep them, and a non-finite number becomes null, which is what JSON.stringify does.
How to use it
JSON5 Formatter: paste the JSON5 into the box above, set Indent (default 2), and press Run to get the JSON below.
Worked example
Input:
{
// a comment the parser must ignore
name: 'Ada',
tags: ['math', 'engine',],
hex: 0x10,
active: true,
}
Output:
{
"name": "Ada",
"tags": [
"math",
"engine"
],
"hex": 16,
"active": true
}
Why it runs in your browser
The conversion happens on this page with JavaScript. Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere. The page reads JSON5 and returns JSON; reloading the page discards both.
The reader accepts the documented subset of JSON5: line and block comments, single-quoted strings, unquoted identifier keys, trailing commas, hexadecimal numbers, a leading plus, a leading or trailing decimal point, Infinity and NaN. The output is strict JSON, so it can go straight into a parser that never heard of JSON5. Two conversions are worth knowing: comments are dropped because JSON has no place to keep them, and a non-finite number becomes null, which is what JSON.stringify does.
Format JSON5 — comments, single quotes, unquoted keys and trailing commas — into strict, indented JSON.
How to use it
JSON5 Formatter: paste the JSON5 into the box above, set Indent (default 2), and press Run to get the JSON below.
Why it runs in your browser
The conversion happens on this page with JavaScript. Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere. The page reads JSON5 and returns JSON; reloading the page discards both.
What to Expect
Best for
- Converting JSON5 to JSON when the data is already on screen.
What this tool keeps
- Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere.
Sample input
{ // a comment the parser must ignore name: 'Ada', tags: ['math', 'engine',], hex: 0x10, active: true, }
Sample output
{ "name": "Ada", "tags": [ "math", "engine" ], "hex": 16, "active": true }
Frequently asked questions
How do I use the json5 formatter?
JSON5 Formatter: paste the JSON5 into the box above, set Indent (default 2), and press Run to get the JSON below.
Is my input uploaded?
No. The text is parsed on this page with JavaScript and is never posted to a server.
Is there a size limit?
Yes: 5 MB per run. Larger input is refused with a message rather than freezing the tab.
Build custom tools for your store
Join the SDK program to create useful ecommerce utilities for your store.