Blog

JSON vs JSON5

2026-11-11

JSON is the format most APIs already speak. JSON5 is a looser syntax that is easier to write by hand. Locache can format and check both in the browser, and the document stays on the device.

What JSON requires

JSON objects use double quotes on every key and every string. Trailing commas are errors. Comments are errors. A file is one value: an object, an array, a string, a number, true, false, or null.

That strictness is why JSON Formatter and JSON Validator can tell you the exact spot a payload broke. JSON Minifier then removes the whitespace you only needed while reading.

What JSON5 adds

JSON5 allows comments, trailing commas, single quotes, and unquoted keys. It is useful in config files that people edit. It is not a drop-in replacement for a JSON API. A service that calls JSON.parse will reject JSON5.

If a file looks like JSON but the validator complains about a comment or a trailing comma, it may be JSON5. Remove those extras, or keep them only in files your own tools know how to read. JSON5 Validator is the Locache check for that looser shape. JSON Schema to Code still expects a JSON Schema document, which is standard JSON.

Which one to send over the wire

Send JSON to other systems. Keep JSON5, when you use it, in local config. Format the JSON you are about to share, compare two payloads with JSON Compare, and do not put secrets in a shared link.