Parse JSON5 — JSON with relaxed syntax
JSON5 extends JSON with comments, trailing commas, unquoted keys, single quotes, and more. Learn the syntax extensions and conversion to standard JSON.
- 1
JSON5 allows: single-quoted strings, unquoted object keys (if they are valid identifiers), trailing commas, comments (// and /* */), hexadecimal numbers, Infinity/NaN, and multi-line strings. It is useful for configuration files where human readability matters.
- 2 JSON Formatter →
Paste JSON5 content and format it as standard JSON. This strips comments, converts single quotes to double quotes, quotes all keys, and removes trailing commas — producing valid JSON that any parser can read.
- 3 JSON Validator →
Validate the converted JSON to ensure it is syntactically correct. JSON5 features that were stripped (comments, trailing commas) do not appear in standard JSON — verify nothing was lost in conversion.
- 4
JSON5 is primarily for human-authored configuration. Never use it for data interchange — standard JSON is universally supported. Convert JSON5 to JSON at build time, not runtime, to avoid shipping a JSON5 parser to the client.
Frequently asked questions
- Is JSON5 a replacement for JSON?
- No. JSON5 is a superset of JSON for human-authored files (configs, fixtures). For data interchange (APIs, storage), use standard JSON — it is universally supported and has no parser ambiguity.
- Can I use JSON5 in my build tool?
- Yes. Many tools (Vite, ts-node, Babel) support JSON5 config files. They parse JSON5 at startup and convert to JSON internally. Check your tool's documentation for JSON5 support.
Workflows that solve this
Learn more
Want to understand why?