NV ToolkitFormat · Validate · Convert

JSON Tools

JSON5 Formatter & Beautifier

Beautify JSON5 the way it's meant to be written — unquoted keys, trailing commas and all, with real JSON5 parsing.

In short

Format JSON5 online: beautify config files with comments, unquoted keys and trailing commas — full JSON5 parsing with exact error positions. Free.

By NaveenKumar T · Updated

Learn: Comments in JSON: Why They're Forbidden and What To Do Instead

  • Full JSON5 parsing
  • Unquoted keys & trailing commas
  • 2/3/4-space or tab indent

Runs entirely in your browser — nothing you paste or open here is uploaded, logged, or stored.How we handle data →

Example

JSON5 Formatter: input and output

An editor settings file written the way humans actually write JSON5 — a comment, unquoted keys, single-quoted strings, and trailing commas.

Input · javascript
{
  // Editor theme settings — safe to hand-edit
  theme: 'dark',
  fontSize: 14,
  tabSize: 2,
  plugins: ['prettier', 'eslint',],
  experimental: {
    inlineHints: true,
  },
}
Output · javascript
{
  theme: 'dark',
  fontSize: 14,
  tabSize: 2,
  plugins: [
    'prettier',
    'eslint',
  ],
  experimental: {
    inlineHints: true,
  },
}

The comment above theme is gone — comments live outside JSON5's data model, so re-serializing can't bring them back — but the unquoted keys, single-quoted strings, and trailing commas you wrote stay intact as valid JSON5 style.

Learn more

Formatting JSON5 correctly

Running JSON5 through a strict JSON formatter fails on the first comment or unquoted key — the features you use JSON5 FOR. This formatter parses the full JSON5 grammar and re-serializes in canonical JSON5 style: unquoted keys where legal, single-quoted strings, your chosen indentation, and precise line/column errors when something is genuinely malformed.

The result stays JSON5. If you need strict JSON output instead — for an API that doesn't speak JSON5 — use the JSON5 Validator page, which converts as it validates.

JSON vs JSONC vs JSON5
FeatureJSONJSONCJSON5
CommentsNoYesYes
Trailing commasNoVS Code's parser: yesYes
Unquoted object keysNoNoYes
Single-quoted stringsNoNoYes
Hex numbers (0xFF)NoNoYes
Leading/trailing decimal point (.5, 5.)NoNoYes
Infinity / NaNNoNoYes
Typical homeAPIs, data filesVS Code settings, tsconfig.jsonConfig files, Babel

Help

Frequently asked questions

Everything you need to know about the JSON5 Formatter.

01What is JSON5 and how is it different from JSON?

JSON5 is JSON for humans: it adds single-line and block comments, unquoted object keys, single-quoted strings, trailing commas, hex numbers, leading/trailing decimal points, and Infinity/NaN. Every JSON document is valid JSON5; the reverse is not true — which is why a dedicated formatter exists.

02Will formatting keep my comments?

Comments exist outside the JSON5 data model, so re-serialization does not preserve them — the formatter normalizes the DATA (keys, values, structure) at your chosen indentation. To restyle a heavily-commented config without touching comments, format selected sections instead of the whole file.

03Where is JSON5 actually used?

Anywhere humans edit config that machines read: Babel (.babelrc), VS Code settings accept comments (JSONC, a close cousin), Chromium uses it internally, and many app configs adopt it for trailing commas alone. If your 'JSON' config tolerates comments, you're probably writing JSON5.

04Is JSONC (VS Code settings) the same as JSON5?

Close cousins, not the same grammar. JSONC — what settings.json and tsconfig.json use — is JSON plus comments and, in VS Code's own parser, trailing commas; it keeps JSON's requirement that keys and strings use double quotes. JSON5 is a larger superset on top of that: unquoted keys, single-quoted strings, hex numbers, leading/trailing decimal points, and Infinity/NaN, none of which a JSONC parser accepts.

05Can I keep the output as strict JSON instead?

This formatter's job is to re-serialize valid JSON5 as JSON5, comments and unquoted keys kept, rather than convert it. For a strict-JSON conversion, paste the same document into the JSON5 Validator, which parses it once and hands back both a validity verdict and the equivalent plain JSON.

Keep working

Related tools

Learn the format

Related guides

All guides →