When to use the JSON Validator
Before sending an API request
Make sure a request body is valid so you are not chasing a vague “400 Bad Request” error.
Checking config files
Validate settings files after editing them by hand, before an app fails to start.
Finding hidden duplicates
Catch repeated keys that many parsers silently accept, which can make the first value disappear.
Teaching and learning JSON
Clear error messages explain what went wrong, which helps beginners learn the rules.
Features and benefits
- Strict RFC 8259 validation
- Human-friendly error messages with line and column
- Detects duplicate keys that other validators silently accept
- Summary of type, keys, nesting depth and size
Example
{
"name": "Lamp",
"price": 29,
}✗ Trailing comma before "}" is not allowed in JSON at line 4, column 1
How the JSON Validator works
The validator follows RFC 8259, the JSON standard. It checks quotes, commas, brackets, numbers and escape sequences, and reports the first error with its line and column. Then it scans the document again to find keys that appear twice inside the same object, which JavaScript’s own parser accepts without warning. Finally it summarises the top-level type, the number of keys, the deepest nesting level and the size in bytes.
A real-life example
An e-commerce team edits a product feed by hand and the import job keeps rejecting it without a useful message. Pasting the 600-line file into the validator shows “Expected a comma or closing brace on line 214, column 9”. Line 213 is missing a comma after a price. The duplicate-key check also warns that “sku” appears twice in one product – a copy-and-paste slip that would have quietly overwritten the first SKU.
Good to know
The JSON standard is stricter than JavaScript. Trailing commas, single-quoted strings, unquoted keys, comments, NaN and leading zeros like 007 are all invalid – and they are the most common reasons an API rejects a request body.
Duplicate keys are technically allowed by the standard but are a frequent source of bugs: most parsers silently keep only the last value. The validator lists every duplicate with its position so you can decide which value is correct.
Only need to read the data? Use the JSON Formatter. Need the smallest possible payload? Use the JSON Minifier.
Tips for the best results
- Fix the first error, then validate again – later errors are often caused by the first one.
- Pay attention to duplicate-key warnings; they often reveal copy-and-paste mistakes.
- Check the nesting depth if a system complains about overly deep documents.
- Use the JSON Formatter afterwards to tidy a valid document.
Common mistakes to avoid
Using comments in JSON
Standard JSON has no comments. Remove // and /* */ comments, or keep them only in JSONC-aware tools.
Using NaN or Infinity
These are not valid JSON numbers. Use null or a string instead.
Escaping incorrectly
Backslashes in Windows paths must be doubled: "C:\\Users".
JSON Validator – frequently asked questions
What standard does this validator use?
RFC 8259, the current JSON standard, which is the same grammar as ECMA-404.
Are trailing commas allowed in JSON?
No. JavaScript accepts them, but JSON does not. Remove the comma after the last item in an object or array.
Why is a duplicate key only a warning?
The standard says names “should” be unique, not “must”, so the JSON is still valid. But different programs handle duplicates differently, so it is worth fixing.
Can I validate against a JSON Schema?
Not yet. This tool checks that the JSON is well-formed, not that it matches a particular schema.
Does valid JSON mean my API will accept it?
Not always. Valid JSON can still have missing fields or wrong types for a particular API. Check the API documentation or a schema.
Is an empty file valid JSON?
No. The smallest valid JSON documents are values such as {}, [] or null.