What the validator checks
Paste JSON and the validator parses it with a strict RFC 8259 parser. On success it prints a short report; on failure it shows a message with the exact line and column, and the editor highlights the spot.
On top of plain syntax, it reports things that are valid JSON but can still cause bugs:
- Duplicate keys — valid, but parsers disagree on which value wins.
- Numbers that lose precision — integers beyond 2^53, decimals with more than about 17 significant digits, and values such as
1e400that overflow to Infinity. - Unpaired surrogate escapes such as
"\uD83D"without its low half. The grammar allows them, but many parsers reject them or replace them with U+FFFD. - Byte order mark at the start of the text (see Strict RFC 8259 below).
- Nesting depth, compared with the limit you choose.
Example: a duplicate key
{
"service": "billing",
"timeout": 30,
"retries": 3,
"timeout": 60
}
The document is valid, so the report starts with a check mark:
✓ Valid JSON (strict RFC 8259)
Top-level type object
Objects 1 (4 keys)
Arrays 0 (0 items)
Max depth 1
Strings 1
Numbers 3
Booleans 0
Nulls 0
Size 76 bytes (UTF-8) · 6 lines
Warnings 1
and the warnings panel says: Duplicate key "timeout" on line 5 — most parsers keep only the last value. In this case most services would use a 60-second timeout, even if the person editing the file only saw the first entry.
Example: a big integer
{ "tweetId": 1850000000000000001, "likes": 42 } is valid, but the validator warns: 1 number cannot be stored exactly as a 64-bit float, so JSON.parse and most parsers change it: 1850000000000000001 → 1850000000000000000. This is why the Twitter/X API also returns id_str. Send such IDs as strings.
Common errors and how to fix them
| Message | Cause | Fix |
|---|---|---|
Missing comma between properties. |
Two properties with no comma between them, e.g. "name": "Ada" followed by "role": "admin" on the next line. |
Add a comma at the end of the earlier line. The location points at the second property. |
Trailing comma is not allowed before }. |
A comma after the last property, common in hand-edited config. | Delete the comma. |
Comments are not allowed in JSON. Use JSON Repair to strip them. |
// or /* */ comments (JSONC, as in tsconfig.json). |
Remove them, or run the text through JSON Repair. |
Strings must use double quotes ("), not single quotes. |
Python or JavaScript object syntax pasted as JSON. | Replace ' with ", or use JSON Repair. |
The text starts with a byte order mark (U+FEFF)… |
The file was saved as “UTF-8 with BOM”, which is common on Windows. | Save it as UTF-8 without BOM, or turn off Strict RFC 8259 if your parser accepts it. |
Nesting depth 4 exceeds the limit of 2. This bracket opens level 3. |
The document is deeper than the Max depth you chose. | Flatten the structure, or raise the limit if your parser allows it. |
Once a document is valid, use the JSON Formatter to pretty-print it, the JSON Viewer to browse it as a tree, or the JSON Schema Generator to describe its shape so you can validate payloads in CI.
Options
- Strict RFC 8259 — on: a leading BOM is an error. Off: the BOM is ignored with a warning. Every other rule is the same in both modes.
- Max depth (under More options) — No limit, 32, 64, 100, 128 or 1000. Depth counts nested objects and arrays:
{}is depth 1,{"a":[1]}is depth 2. Documents nested thousands of levels deep cannot be parsed in the browser at all, and are reported as “Nesting too deep”.
Validating in code
The checks here match what you get from a strict parser plus a few extra lines:
// JavaScript (Node 22): syntax only. Duplicate keys are silently merged and big numbers rounded.
const text = '{\n "name": "Ada"\n "role": "admin"\n}';
try {
JSON.parse(text);
} catch (e) {
console.error(e.message); // Expected ',' or '}' after property value in JSON at position 20 (line 3 column 3)
}
# Python: reject duplicate keys explicitly
import json
def no_duplicates(pairs):
seen = set()
for key, _ in pairs:
if key in seen:
raise ValueError(f"duplicate key: {key!r}")
seen.add(key)
return dict(pairs)
json.loads(text, object_pairs_hook=no_duplicates)
Python’s json module keeps big integers exact, unlike JavaScript, so a document can behave differently in a Python backend and a browser front end. The precision warning catches that before it causes a bug.
Frequently asked questions
Is a duplicate key an error?
No. RFC 8259 says object names SHOULD be unique, not MUST, so a document with a repeated key is still valid JSON. It is reported as a warning with the line of the second occurrence, because parsers do not agree on it: JavaScript, Python and Go keep the last value, while some libraries can be set to reject the document (Jackson's STRICT_DUPLICATE_DETECTION, for example).
What does Strict RFC 8259 change?
With it on (the default), a byte order mark (U+FEFF) at the start of the text is an error, because RFC 8259 says implementations must not add one and JSON.parse rejects it. With it off, the BOM is ignored and reported as a warning. Comments, trailing commas, single quotes and other non-JSON syntax are errors in both modes — use JSON Repair to fix them.
Why does it warn about a number that looks fine?
Most JSON parsers store numbers as 64-bit floats, which hold integers exactly only up to 2^53 (9007199254740992) and keep about 15–17 significant digits. The validator re-reads every number the way JSON.parse would and warns when the value changes, for example 1850000000000000001 becoming 1850000000000000000. Send IDs like that as strings.
Is a bare string or number valid JSON?
Yes. Since RFC 7159 (2014) any JSON value can be the top-level value, so "hello", 42, true and null are valid documents. The old RFC 4627 required an object or array, and a few very old parsers still do.
What is the Max depth option for?
Several parsers refuse deeply nested documents: .NET System.Text.Json stops at 64 levels by default, Ruby's JSON at 100, serde_json at 128 and Jackson at 1000. Pick the limit of the parser that will read your JSON, and the validator points at the first bracket that goes past it.
Is my JSON uploaded?
No. Validation runs in your browser and nothing is uploaded, so you can check API responses or config files that contain internal data.
Last updated