Skip to content
Free Tool Arena

Glossary · Definition

JSON vs JSON5

JSON (RFC 8259) is the strict standard: keys must use double quotes, no comments, no trailing commas. JSON5 is a developer-friendly superset: allows unquoted keys, single quotes, comments, and trailing commas. Use JSON for APIs and data interchange; JSON5 for config files where humans edit.

Updated May 2026 · 4 min read
100% in-browserNo downloadsNo sign-upMalware-freeHow we keep this safe →

Definition

JSON (RFC 8259) is the strict standard: keys must use double quotes, no comments, no trailing commas. JSON5 is a developer-friendly superset: allows unquoted keys, single quotes, comments, and trailing commas. Use JSON for APIs and data interchange; JSON5 for config files where humans edit.

What it means

RFC 8259 strict JSON requires: double-quoted strings only, no comments anywhere, no trailing commas, no special characters unescaped. Developer pain points: can&rsquo;t add explanatory comments to config files, trailing commas in arrays/objects cause errors, copy-paste from JavaScript breaks. JSON5 relaxes these: <code>// line</code> and <code>/* block */</code> comments allowed, single quotes allowed, trailing commas allowed, hex numbers (0xFF) allowed, multi-line strings via line continuation. Most major projects (Babel, RollupJS, Bun, ESLint config) accept JSON5 for config. APIs typically still require strict JSON.

Advertisement

Why it matters

Config files written in JSON5 are dramatically more maintainable: comments document why, trailing commas survive line-rearrangement, single quotes match JavaScript style. Tools that accept JSON5 are signaling they value developer ergonomics. Tools that strictly require JSON are typically older or have backwards-compatibility constraints. JSONC (JSON with comments only) is a middle ground used by VS Code settings, tsconfig.json — strict JSON syntax PLUS line/block comments.

Example

JSON: <code>&#123;&quot;name&quot;: &quot;ada&quot;, &quot;active&quot;: true&#125;</code>. JSON5: <code>&#123; name: &lsquo;ada&rsquo;, // creator account active: true, &#125;</code>. Both represent the same data; JSON5 is more readable and tolerates trailing comma + comment.

Related free tools

Frequently asked questions

When is JSON5 NOT appropriate?

API responses (clients expect strict JSON), database storage where the column type enforces strict, log files parsed by other tools that don&rsquo;t support comments. Always send strict JSON over the wire.

Can I parse JSON5 in JavaScript?

<code>JSON.parse()</code> doesn&rsquo;t support JSON5. Use the <code>json5</code> npm package: <code>const json5 = require(&lsquo;json5&rsquo;); json5.parse(input);</code>. Or pre-process input to strip comments / convert quotes before passing to <code>JSON.parse()</code>.

What about JSONC?

JSONC = JSON with Comments. Less permissive than JSON5 — only adds line and block comments, doesn&rsquo;t allow unquoted keys or single quotes. Used by VS Code and TypeScript config files. Easier to support in tooling than full JSON5.

Related terms