← Back to Blog

JSON vs JSON5: What's the Difference and Why It Matters

By M Nouman Saeed · Published on September 12, 2026 · 6 min read

If you've ever pasted a config file into a JSON formatter and gotten a confusing syntax error on a line that looked completely fine, there's a good chance you were looking at JSON5, not standard JSON. They look almost identical, but the rules underneath are different enough to matter.

💡 Pro-Tip: One Tool, Both Formats

Our free online JSON formatterunderstands both standard JSON and JSON5 automatically — paste either one in and it parses correctly, no need to tell it which format you're using.

What is JSON5?

JSON5 is an extension of standard JSON designed to be easier for humans to read and write by hand. It was created because strict JSON, while great for machines exchanging data, is surprisingly unforgiving for the config files developers actually edit by hand — one missing quote or one trailing comma and the whole file fails to parse.

JSON5 is a superset of JSON: any valid JSON document is automatically valid JSON5. But JSON5 adds several conveniences that standard JSON strictly forbids.

The Key Differences

  • Comments: JSON5 allows // and /* */ comments. Standard JSON has no concept of comments at all.
  • Trailing commas: JSON5 allows a trailing comma after the last item in an object or array. In standard JSON, this is a syntax error — the single most common cause of "Unexpected token" errors, which we cover in our JSON parse error guide.
  • Unquoted keys: JSON5 lets you write { name: "value" } instead of requiring { "name": "value" }, as long as the key is a valid identifier.
  • Single quotes: JSON5 accepts single-quoted strings. Standard JSON requires double quotes for every string, with no exceptions.
{ // This is a JSON5 comment name: 'CleanTextLabs', tools: ['cleaner', 'formatter', 'counter', 'slugger'], active: true, }

The example above — comments, unquoted keys, single quotes, and a trailing comma — is valid JSON5, but every one of those choices would throw a syntax error in standard JSON.

When Should You Use Each?

Use standard JSON anywhere data crosses a system boundary: API requests and responses, data files exchanged between services, anything a machine reads without a human editing it directly. Nearly every API and data-interchange format in the wild expects strict JSON, full stop.

Use JSON5 for files humans actually hand-edit: local config files, build tool settings, editor configuration. The ability to leave a comment explaining why a setting is set the way it is, or to add a new line to an array without carefully removing the trailing comma from the previous line, meaningfully reduces hand-editing mistakes.

Why This Trips People Up

The confusion almost always happens in one direction: someone copies a JSON5 config file (with comments or a trailing comma) and pastes it somewhere expecting strict JSON — an API testing tool, a strict JSON.parse()call, a production system — and it fails. The file wasn't broken; it just wasn't standard JSON to begin with.

A formatter that understands JSON5 (like ours) can read both, but that also means it's worth knowing which one you're actually looking at before you paste it somewhere that only accepts the stricter format. For more on formatting and validating JSON in general, see our JSON formatting guide.

Frequently Asked Questions

Is JSON5 a completely different format from JSON?

No — JSON5 is a superset of JSON. Every valid JSON document is also valid JSON5, but JSON5 additionally allows things standard JSON forbids, like comments, trailing commas, and unquoted keys. The reverse isn't true: a JSON5 file using those extra features is not valid standard JSON.

Can I send JSON5 to a REST API?

Generally, no. Almost all APIs expect strict JSON and will reject JSON5-specific syntax like comments or trailing commas. JSON5 is meant for files humans write and edit directly, not for data sent over the wire between systems.

Where does JSON5 actually show up in practice?

Mostly in developer-facing config files — things like build tool configs, editor settings, and some JavaScript project files — where the ability to add comments and leave trailing commas makes hand-editing significantly less error-prone.

Will a standard JSON parser accept a JSON5 file?

No. A strict JSON.parse() call will throw a syntax error on comments, trailing commas, or unquoted keys. You need a JSON5-aware parser to read those files, which is exactly what a JSON5-aware formatter like ours does automatically.

Not sure if your file is valid JSON or JSON5?

Paste it in — our formatter handles both automatically.

Go to JSON Formatter