What is JSON validation?
JSON validation checks whether a string of text conforms to the JSON specification (RFC 8259). Valid JSON has a precise set of rules: keys must be double-quoted strings, values must be one of six types (string, number, boolean, null, object, or array), and the structure must be syntactically correct. Even a single misplaced comma or unquoted key will cause a parser to reject the entire document. This validator uses the browser's native JSON.parse to detect errors and reports the exact location of the problem.
What the validator checks
The validator catches common issues developers encounter when working with JSON:
- Missing or extra commas between properties or array items
- Unquoted or single-quoted keys (keys must use double quotes)
- Trailing commas after the last property (not valid in JSON)
- Unclosed brackets
[]or braces{} - Invalid escape sequences inside strings
- Comments (
// ...or/* ... */are not valid in JSON) - Undefined values (use
nullinstead ofundefined) - Values that are not valid JSON types (functions, dates as objects, etc.)
Common JSON errors and how to fix them
Trailing comma
JSON does not allow a comma after the last property in an object or the last item in an array.
❌ Invalid: {"name": "John", "age": 25,}
✓ Valid: {"name": "John", "age": 25}
Single-quoted strings
JSON requires double quotes. Single quotes are valid in JavaScript but not in JSON.
❌ Invalid: {'name': 'John'}
✓ Valid: {"name": "John"}
Unquoted key
All keys in a JSON object must be quoted with double quotes.
❌ Invalid: {name: "John"}
✓ Valid: {"name": "John"}
Undefined value
undefined is not a valid JSON value. Use null to represent an absent or unknown value.
❌ Invalid: {"active": undefined}
✓ Valid: {"active": null}
Comments
JSON does not support comments. Remove them or use JSONC (JSON with Comments) format in your editor.
❌ Invalid: // User data
{"name": "John"}
✓ Valid: {"name": "John"}
Frequently Asked Questions
Why is my JSON invalid if it works in JavaScript?
JavaScript is more permissive than JSON. JavaScript allows unquoted keys, single quotes, trailing commas, and comments in object literals. JSON is a strict data format that does not allow any of these. If you are working with JavaScript object literals, you need to convert them to valid JSON before using a JSON validator.
What is the difference between JSON and JSON5?
JSON5 is an extension of JSON that allows unquoted keys, single quotes, trailing commas, and comments. It is supported by some tools and environments but is not standard JSON. This validator checks standard JSON only.
Is my data sent to a server?
No. Validation uses the browser's built-in JSON.parse function. Your data never leaves your device.
Can I validate very large JSON files?
Yes. Validation runs natively in the browser and is generally fast even for large inputs. However, extremely large files may slow down the editor rendering.
