JSON Validator Online
Paste any JSON to instantly check its syntax, identify errors by line number, and format it for readability. Free, private, no signup required.
Open JSON Validator →
What is JSON Validation?
JSON validation is the process of checking that a piece of text conforms to the JSON specification (ECMA-404 / RFC 8259). Valid JSON must follow strict rules about syntax: keys must be double-quoted strings, values must be one of six types (string, number, boolean, null, array, or object), arrays and objects must be properly closed, and trailing commas are not permitted.
JSON validation is one of the most frequent tasks in everyday API development. You need it when:
- An API call returns an unexpected error and you suspect the request body is malformed
- A configuration file is silently ignored and you want to confirm it is being parsed
- You are hand-editing JSON and want to verify there are no typos before committing
- A log aggregator or database is rejecting a document and you need to find the invalid field
- You are receiving JSON from an external partner and want to confirm it matches the expected structure
The JSON validator on JSON Web Tools highlights the exact line and column where a syntax error was detected, making it fast to locate and fix problems even in large JSON documents.
Common JSON Errors and How to Fix Them
Trailing comma
This is the most frequent JSON error. Standard JSON does not allow a comma after the last element in an object or array. Many developers coming from JavaScript (which allows trailing commas) make this mistake.
// Invalid JSON
{ "name": "Alice", "age": 30, }
// Valid JSON
{ "name": "Alice", "age": 30 }
Single quotes instead of double quotes
JSON requires double quotes for both keys and string values. Single quotes are JavaScript syntax, not JSON syntax.
// Invalid JSON
{ 'name': 'Alice' }
// Valid JSON
{ "name": "Alice" }
Unquoted keys
In JavaScript object literals, keys can be unquoted. In JSON, all keys must be quoted strings.
// Invalid JSON
{ name: "Alice" }
// Valid JSON
{ "name": "Alice" }
Comments in JSON
JSON does not have a comment syntax. Comments that work in JavaScript (// ... or /* ... */) will cause a parse error in JSON. If you need comments in configuration files, use JSONC (JSON with Comments) format and a parser that supports it.
Undefined, NaN, and Infinity
These are JavaScript values that have no JSON equivalent. undefined, NaN, and Infinity in a JSON string will cause a validation failure. Use null or a sentinel numeric value instead.
Missing comma between elements
Every element in an array and every key-value pair in an object (except the last one) must be followed by a comma.
// Invalid JSON
{ "name": "Alice" "age": 30 }
// Valid JSON
{ "name": "Alice", "age": 30 }
How to Use the JSON Validator
- Click "Open JSON Validator" above.
- Paste your JSON into the input field. The tool validates as you type.
- If the JSON is valid, you will see a green confirmation and the formatted output.
- If there is an error, the problematic line is highlighted and the error message explains the issue.
- Fix the error, re-paste, and validate again until the JSON is clean.
- Copy the formatted JSON output for use in your project.
The validator also prettifies your JSON - adding consistent indentation and line breaks - which makes large, minified JSON documents much easier to read and debug.
Frequently Asked Questions
How do I validate JSON online?+
Paste your JSON into the validator above and click Validate. The tool instantly checks your JSON for syntax errors and shows the exact line and column of any problem with a clear error message.
What are the most common JSON errors?+
The most common JSON errors are: trailing commas after the last item (not allowed in JSON), single quotes instead of double quotes, unquoted property keys, missing commas between items, JavaScript-style comments (// or /* */), and using undefined, NaN, or Infinity values.
What is the difference between JSON syntax validation and schema validation?+
Syntax validation checks if the JSON is well-formed and parseable. Schema validation checks if the parsed JSON matches an expected structure — correct field names, types, and constraints. Use the
JSON Schema Validator for structure validation.
Can I validate JSON from a URL or file?+
Yes. You can paste JSON text, upload a .json file, or fetch JSON from a URL. All processing happens in your browser — the URL fetch is also client-side using the Fetch API.
Does JSON allow trailing commas?+
No. Standard JSON does not allow trailing commas — this is one of the most common sources of invalid JSON. Some tools support JSONC (JSON with Comments) which allows trailing commas, but strict JSON parsers like JSON.parse() will reject them.
What JSON standard does this tool use?+
This tool validates against the official JSON specification defined in RFC 8259 and ECMA-404. It uses the browser's native JSON.parse() under the hood, which is fast and fully spec-compliant.
Also useful: JSON Repair Tool | CSV to JSON Converter | JWT Decoder | JSON Guides