HCODX/JSON5 Formatter
100% browser-based · Comments, trailing commas, unquoted keys

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.

JSON5 input
Beautified output
Format options
Strict JSON formatter
Input size
0 B
Output size
0 B
Output lines
0
Status
Ready
Example

Compact in, annotated out

JSON5 lets you keep comments, single quotes, trailing commas, and unquoted keys. The formatter indents structure while preserving these relaxations.

Compact JSON5
{name:'hcodx',unquoted:true,items:[1,2,3,],}
Beautified
{
  // JSON5 — relaxed superset of JSON
  name: 'hcodx',
  unquoted: true,
  items: [1, 2, 3],
}
Use cases

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.

Step by step

How to format JSON5

1

Paste your JSON5

Including comments, trailing commas, unquoted keys.

2

Pick indent

2 / 4 / tab, like any formatter.

3

Click Beautify

json5 parses then re-emits with structure.

4

Copy as .json5

Or strict JSON via the strict-formatter link.

FAQ

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

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// line and /* 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.
Related

Related tools