JSON5 Formatter
Paste JSON5 — with comments, trailing commas, single quotes and unquoted keys — and get clean, standard JSON back.
Example
Input
{
// a JSON5 document
name: 'CalcCafe',
tags: [1, 2, 3,],
}Output
{
"name": "CalcCafe",
"tags": [
1,
2,
3
]
}How it works
JSON5 is a superset of JSON that allows comments, trailing commas, unquoted keys and single quotes. This tool parses JSON5 and re-serialises it as strict, formatted JSON that any parser can read.
Good to know
The JSON5 Formatter takes a JSON5 document — the relaxed, human-friendly dialect of JSON that permits comments, trailing commas, unquoted object keys, single-quoted strings and hexadecimal numbers — and re-serialises it as strict, indented JSON that any standard parser will accept. It's built for developers who hand-edit config files (think Babel, ESLint or VS Code settings written in JSON5/JSONC) and need to hand the result to a tool, API or language runtime that only speaks plain JSON.
Reaching for it makes sense whenever you have a "loose" object that a strict consumer keeps rejecting: a curl payload that fails with a parse error because of a stray trailing comma, a snippet copied from documentation that uses single quotes, or a commented config you want to flatten before committing it to a system that can't store comments. Because the conversion happens entirely in your browser via the bundled JSON5 library, you can paste secrets, tokens or internal payloads without anything leaving your device.
Reading the output is straightforward: every key becomes double-quoted, single quotes turn into double quotes, trailing commas disappear, and arrays and objects are pretty-printed with consistent indentation. If you get an error instead of formatted output, your input isn't even valid JSON5 — check for unterminated strings, a missing closing brace, or duplicate keys.
- One caveat to plan around: comments are silently dropped, since they have no representation in strict JSON. If those comments document why a value exists, copy them somewhere safe before converting, or keep your authoritative file in JSON5 and treat the JSON output as a generated artifact.
Frequently asked questions
What does JSON5 allow that JSON doesn't?
Comments, trailing commas, unquoted object keys, single-quoted strings, hex numbers and more — it's designed to be hand-written.
Does the output keep comments?
No — comments aren't valid in strict JSON, so they're dropped when converting JSON5 to JSON.
Is my JSON uploaded anywhere?
No — everything runs in your browser with JavaScript. Your data never leaves your device, so it's safe for sensitive payloads and works offline once loaded.
Is this tool free?
Yes, completely free with no sign-up and no limits.
More JSON tools
People also ask
What is the difference between JSON5 and JSONC?
JSONC is essentially JSON with comments (used by VS Code config files), while JSON5 is a broader superset that also adds trailing commas, unquoted keys, single quotes, hex numbers and more. JSON5 will accept most JSONC input, but not every JSON5 feature is valid JSONC.
Can I convert standard JSON to JSON5 with this tool?
No. This tool reads JSON5 (and plain JSON, since JSON is a subset) and outputs strict JSON. Standard JSON is already valid JSON5, so there is no conversion needed in that direction.
Why does my JSON5 fail to parse here?
Common causes are unterminated strings, mismatched or missing brackets and braces, a key that contains characters requiring quotes, or duplicate keys. The parser stops at the first syntax error it cannot recover from.
Does JSON5 support NaN and Infinity?
Yes, JSON5 allows Infinity, -Infinity and NaN as numeric values. However, these are not valid in strict JSON, so converting them produces output that standard JSON parsers will reject.
Is .json5 a real file extension I should use?
Yes, .json5 is the conventional extension for JSON5 documents. Many tools also accept JSON5-style content in .jsonc or even .json files, depending on the parser they use.
Will the formatter preserve the order of my keys?
Yes, object keys are kept in the order they appear in your input. The tool reformats spacing and quoting but does not reorder or alphabetize properties.
Can I use this tool offline?
Once the page and its scripts have loaded in your browser, the formatting runs locally, so it continues to work without an active internet connection until you close or reload the tab.