JSON5 Validator
Validate JSON5 and convert it to strict JSON — with a list of every JSON5-only feature used and the line it first appears on.
About this result
What It Does
This validator checks a document against the JSON5 specification — JSON plus comments, trailing commas, unquoted keys, single-quoted and multi-line strings, hex numbers, Infinity and NaN — and reports errors with their exact line and column. When it is valid, it lists every JSON5-only feature the document uses and where each first appears, then converts the whole thing to strict JSON that any parser accepts.
When to Use It
- You maintain a JSON5 config — Babel, a Chromium or Electron settings file, a game data file — and want to check it before shipping.
- A tool that only reads JSON is rejecting a config file and you need to know exactly which lines are the problem.
- You want to convert a hand-written JSON5 file into plain JSON for an API or a database.
- You are deciding whether a file needs a JSON5 parser at all, or only uses plain JSON.
Worked Examples
{
// app settings
name: 'demo',
port: 0x1F90,
debug: true,
}
Valid JSON5 using comments, unquoted keys, single quotes, hex and a trailing comma — five features, listed with their lines. Converts to {"name": "demo", "port": 8080, "debug": true}.
{
ratio: .5,
max: Infinity,
}
Valid JSON5, but Infinity has no JSON form: in the converted output it becomes null, and the tool warns you.
{
a: 1
b: 2
}
Invalid even as JSON5 — the comma after the first value is missing. The error points at line 3.
Features
How to Use
1. Paste your input into the top box. 2. Adjust the options if the page has any — the result updates as you type. 3. Read the notes under the result, then copy it.
Common Mistakes
- Editing the result by hand and breaking the escaping. If you need to change the content, change the input and run it again — a single stray backslash makes the whole value invalid.
- Assuming the browser preserved Windows line endings. A pasted CRLF becomes LF in any text box, so a byte-exact comparison with the original file can still differ.
- Trusting that two documents are equal because they look equal. Key order, whitespace and number formatting differ between serializers; compare parsed values, not text.
Frequently Asked Questions
Related Tools
Everything runs in your browser. Your JSON is never uploaded, logged or stored.