JSON5 to JSON
This converter parses JSON5 and turns it back into strict, standards-compliant JSON. JSON5 allows single quotes, unquoted keys, trailing commas, comments and hexadecimal numbers, and many hand-written config files are really JSON5; converting them lets you feed the data to any program that only accepts standard JSON. Indentation and recursive key sorting are configurable, syntax errors point to the offending line and column, and the conversion runs entirely in your browser — nothing is uploaded.
How to use it
- 1
Paste your JSON5
Drop JSON5 text into the editor — comments, single quotes, unquoted keys and trailing commas are all accepted — or pick a local file.
- 2
Choose indent and sorting
Output is strict JSON; pick 2 spaces, 4 spaces or a tab, and optionally sort keys recursively.
- 3
Read any error location
A syntax error highlights the line and column so you can find the key or value that broke parsing.
- 4
Copy the JSON
Copy the standard JSON text, or switch to the reverse direction to produce JSON5.
Key features
Relaxed syntax support
Handles single quotes, unquoted keys, trailing commas, line and block comments, and hexadecimal numbers.
Strict JSON output
The result is standard JSON that every parser accepts, with a configurable indent style.
Key sorting
Recursively sort keys so the output is stable and easy to compare.
Error location
Syntax errors report the line and column so you can jump straight to the problem.
Round-trip friendly
Pairs with the JSON to JSON5 converter for the opposite direction.
Local and private
Parsing and serialisation run in a Web Worker in your browser; nothing is uploaded.
Common errors & troubleshooting
- ! Infinity and NaN cannot be represented as standard JSON numbers; the tool reports an error, so replace them with finite values first.
- ! Comments and single quotes are not preserved — standard JSON has no syntax for them, so only the data itself survives the conversion.
- ! Hexadecimal numbers are parsed as their decimal value in the output, because the 0x form is not valid in standard JSON.
- ! If parsing fails, test a smaller fragment first to confirm which key or value is the culprit.
Frequently asked questions
Which JSON5 features does this tool accept?
Single-quoted strings, unquoted keys, trailing commas, line (//) and block (/* */) comments, hexadecimal numbers, and decimals written as .5 or 5.
Are comments kept in the output?
No. Standard JSON has no comment syntax, so comments and quote styles are dropped during parsing and only the data is kept.
Why does Infinity or NaN cause an error?
Standard JSON cannot represent Infinity or NaN, so the tool reports a semantic error — replace those values with finite numbers or null.
Is my data uploaded?
No. The conversion runs locally in your browser; nothing leaves your device.
Related tools
JSON to JSON5
Convert standard JSON to relaxed JSON5 with single quotes, unquoted keys and trailing commas. Quote style and indentation are configurable.
JSON Validator
Check whether your JSON is valid. Syntax errors are highlighted with the exact line and column, plus a hint about the token that was expected.
JSON Formatter
Format, beautify and validate JSON in your browser. Errors point to the exact line and column, and you can indent with 2 spaces, 4 spaces or a tab.