JSON5 Syntax Checker & Linter
Paste JSON5 data and instantly check for syntax errors with detailed error messages and line numbers
Paste JSON5 with comments, trailing commas, or unquoted keys and get instant validation with exact line-and-column error reporting. Convert valid JSON5 to strict JSON in one click when your target system won’t accept the relaxed syntax. And everything runs in your browser. Nothing gets uploaded.
How It Works
The parser walks through your input character by character, handling JSON5-specific tokens like single-line comments, hex literals, and unquoted keys. If it hits something invalid, it reports the exact position. Valid data gets prettified with syntax highlighting. Hit “Convert to JSON” and it strips out all the JSON5 extras — comments removed, keys quoted, trailing commas gone — so you get strict JSON ready for any parser.
Examples
Config file with comments and trailing commas
You’re editing an app config that uses JSON5 for readability. Need to check it’s valid before deploying.
{
// Server settings
host: 'localhost',
port: 3000,
debug: true,
}
✓ Valid JSON5
{
"host": "localhost",
"port": 3000,
"debug": true
}
Catching a missing comma
Quick syntax check on data that looks right but isn’t.
{
name: 'widget'
version: 2
}
✗ Error at line 3, col 3:
Expected ',' or '}' after
property value
Hex numbers, Infinity, and multi-line strings
Testing all the JSON5 extras that standard JSON rejects. Hex values, special numeric types, and a string that spans two lines.
{
color: 0xFF3200,
timeout: Infinity,
msg: 'line one line two',
}
✓ Valid JSON5
Converted JSON:
{
"color": 16724480,
"timeout": null,
"msg": "line one line two"
}
Who Uses This
Validate JSON5 config files before builds so a stray typo doesn’t crash the pipeline.
Convert annotated JSON5 configs to strict JSON for tools that only accept standard format.
Check JSON5 data exports from APIs or scripts that use the relaxed syntax before importing elsewhere.
Learn the differences between JSON and JSON5 by testing various syntax features and seeing what’s valid.
Common Mistakes
Something like url: 'http://example.com' is fine — the // only starts a comment when it’s outside a string. But if your string isn’t properly quoted, the parser will treat everything after // as a comment. Make sure your strings are closed.
JSON5 happily accepts Infinity and NaN. Standard JSON does not. When you convert, those values become null. If you need them, handle the conversion in code instead of using plain JSON output.
Unquoted keys in JSON5 follow JavaScript identifier rules. my-key won’t work because the hyphen isn’t valid in an identifier. Use 'my-key' with quotes instead. Same goes for keys starting with numbers or containing spaces.
Technical Details
- Processing: 100% client-side — nothing leaves your browser
- Browser Support: Chrome, Firefox, Safari, Edge
- JSON5 Spec: Full support including comments, hex, Infinity/NaN, trailing commas, unquoted keys
- Max Input: Limited only by your browser’s memory
Frequently Asked Questions
What is JSON5 and how is it different from regular JSON?
JSON5 is an extension of JSON based on ECMAScript 5.1 syntax. It adds support for comments (both // and /* */), trailing commas, unquoted object keys, single-quoted strings, hex numbers, and special values like Infinity and NaN. Regular JSON doesn’t allow any of these — a single trailing comma will break most parsers.
Can I convert JSON5 to normal JSON?
Yes. After your JSON5 validates, click “Convert to JSON” and you’ll get strict JSON output. Comments get stripped, unquoted keys get quoted, single quotes become double quotes, and trailing commas disappear. Keep in mind that Infinity and NaN become null since standard JSON can’t represent them.
Is my data uploaded anywhere?
No. The entire validation and conversion process runs in your browser using JavaScript. Nothing is sent to a server. You can disconnect from the internet and the tool still works — that’s how you know it’s genuinely local.
Why does my JSON5 fail validation when it looks correct?
Most often it’s an unquoted key that contains a character JSON5 doesn’t allow — hyphens, dots, or starting with a digit. Unquoted keys must follow JavaScript identifier rules. Wrap the key in single or double quotes and try again. The error message will point you to the exact line and column.
What happens to comments when converting to JSON?
They’re removed entirely. Standard JSON has no concept of comments, so the converter drops them during the transformation. If you need to preserve comments, keep a copy of your original JSON5 file alongside the converted JSON output.