JSON5 to JSON
JSON5 relaxes JSON towards JavaScript: unquoted keys, single-quoted strings, comments, trailing commas, hex numbers, leading +. This converts it to strict JSON that any parser will accept. Input that is already valid JSON is simply reformatted.
How to convert JSON5 to JSON
- Paste your JSON5 into the input pane.
- If it is already strict JSON the tool says so and just reformats it.
- Otherwise the relaxed parser runs and the strict equivalent appears on the right.
- Choose an Indent — including Minified for the most compact form.
- Copy or download the result.
What JSON5 allows that JSON does not
- Unquoted object keys —
{name: 1}. - Single-quoted strings —
'hello'. - Comments — both
//and/* */. - Trailing commas in objects and arrays.
- Hex numbers (
0xFF), leading or trailing decimal points (.5,5.), explicit+signs. InfinityandNaN— these have no JSON representation, so they cannot survive the conversion; replace them withnullor a string first.
How the conversion works
The relaxed parse uses the jsonrepair library, loaded from a CDN the first time you convert
something that is not already valid JSON — so this one page needs a network connection on first use, while
every other tool here works fully offline. Your data still never leaves the browser; only the library
comes down the wire.
If your input only has comments and trailing commas, JSONC → JSON handles it with no library at all.
Privacy
Nothing is uploaded. The conversion runs in this tab using your own browser's JavaScript engine — no server sees your data, and the page keeps working with the network disconnected.
FAQ
Where is JSON5 used?
Configuration files where humans do the editing — some build tools, Babel configs, and a number of game and app config formats. It never became a web standard, so APIs almost never speak it.
Will it fix genuinely broken JSON too?
Often, yes — the same parser powers JSON repair, which additionally shows a change log and handles LLM output wrapped in prose. Use that page when the input is broken rather than deliberately JSON5.
Are comments preserved?
They cannot be — strict JSON has no comment syntax. If you need to keep them, keep the JSON5 file as the source of truth and generate the strict version at build time.