JSON5 Formatter
Format JSON5 in your browser. JSON5 is the relaxed superset of JSON — it supports comments, trailing commas, unquoted keys, single quotes, and hex/special numbers. Parse and re-emit with indentation, or minify back to compact JSON5. Powered by json5 v2, runs locally.
Compact in, annotated out
JSON5 lets you keep comments, single quotes, trailing commas, and unquoted keys. The formatter indents structure while preserving these relaxations.
{name:'hcodx',unquoted:true,items:[1,2,3,],}{
// JSON5 — relaxed superset of JSON
name: 'hcodx',
unquoted: true,
items: [1, 2, 3],
}What you'll use this for
Anywhere unreadable JSON shows up — API responses, log lines, copy-pasted config, compressed payloads.
Config files
Use JSON5 for app configs with inline comments — Babel, Webpack, and many others accept it.
Migrating from JSON
Add comments to existing JSON without breaking parse — paste, tweak, re-emit as JSON5.
VSCode / TS configs
tsconfig.json and VSCode settings already accept comments; JSON5 is the spec they follow.
API debug payloads
Annotate API responses with comments while debugging — keep working code shareable.
How to format JSON5
Paste your JSON5
Including comments, trailing commas, unquoted keys.
Pick indent
2 / 4 / tab, like any formatter.
Click Beautify
json5 parses then re-emits with structure.
Copy as .json5
Or strict JSON via the strict-formatter link.
Frequently asked questions
Yes. No signup, no limits, no ads.
Yes — switch Mode to Minify. The output is still JSON5 (single-quoted strings, etc.); switch to strict JSON via the JSON formatter.
Yes — runs in your browser.
JSON5 adds: // comments, /* block comments */, single-quoted strings, unquoted object keys, trailing commas, leading/trailing decimal points, Infinity/NaN/+0, and hex numbers. See json5.org.
Yes — JSON5 is a strict superset of JSON. Any valid JSON document is also valid JSON5.
About this formatter
JSON5 is a strict superset of JSON that's friendlier to humans: comments, trailing commas, single quotes, unquoted keys. It's used by Babel, Webpack, ESLint configs, and as the basis for TS configs / VSCode settings.
What's supported
- Comments —
// lineand/* block */. - Trailing commas — in arrays and objects.
- Unquoted keys — when they're valid identifiers.
- Single quotes — alternative to double-quoted strings.
- Numbers — leading
+, trailing., hex,Infinity,NaN.
What it isn't
- Not JSON. If you need strict JSON, use the JSON formatter — JSON5 features will be lost.
- Not YAML. Different format, different goals.
- Not JSONC. JSONC = JSON with comments only; JSON5 is the broader spec.