A complete JSON parser test suite
This page is a complete, browser-runnable JSON test suite: 45 valid and 74 intentionally invalid JSON fixtures covering every corner of RFC 8259 — number formats, string escapes, surrogate pairs, multi-byte UTF-8, deep nesting, duplicate keys, trailing garbage, commas, comments and more. Each fixture is the exact input used by npm run test, encoded into the page URL so a click opens it in the viewer with no upload.
pass-* fixtures must parse cleanly; fail-* fixtures must surface as INVALID with a syntax-error location. Use this as a reference set for building or stress-testing your own JSON parser, or as a quick way to see how Fast JSON Viewer behaves on each edge case. Each link encodes the file content into the URL hash (#jsonString=) — the JSON stays in the URL after loading so you can bookmark or share any case.
Valid JSON — parser must accept (45)
- All single-char escapes packed into one array element.
- String containing every printable ASCII character (0x20..0x7E).
- Top-level false literal.
- Top-level negative integer (-42).
- Top-level negative zero (-0) — distinct token, same value as 0.
- Top-level null literal.
- Top-level positive integer (42).
- Top-level string — RFC 8259 allows any value at the root.
- Top-level true literal.
- Top-level integer 0 — smallest possible JSON.
- 30 levels of alternating object/array nesting — depth stress test.
- Duplicate object keys — RFC allows them; viewer keeps the last.
- Empty array [].
- Empty object {}.
- Object with an empty-string key — "" is a valid key.
- Empty string used as key, value, and array element.
- Object key containing every escape — keys are strings too.
- Exponent sign cross-product: 1e0, 1e+0, 1e-0, 1E0, etc.
- Numbers at the IEEE-754 boundary: 1e-300, 1e+300, 5e-324.
- Five nested arrays with primitives at every level.
- Object alternating null / true / false values.
- Classic json.org "pass1" suite — numbers, escapes, whitespace, nesting in one document.
- A JSON document embedded as a string inside another JSON document.
- Array of 100 small integers — tests dense numeric arrays.
- Object with 50 keys — exercises object-member iteration.
- Hex digits in \uXXXX are case-insensitive — \u00e9 vs \u00E9.
- CRLF + tab + LF whitespace interleaved between tokens.
- Object whose values cover string, number, null, bool, array — common shape.
-
pass-multilingual-100kb.json100.1 KB~100 KB of repeated multilingual records — tests the chunked path on a non-trivial size.
- Several spellings of negative zero: -0, -0.0, -0e0.
- 19 levels of nested arrays wrapping a single string.
- 20 levels of nested arrays — historically rejected by depth-limited parsers; RFC permits it.
- String containing \u0000 — the NUL character.
- Mixed integer, decimal, signed-zero and scientific forms.
- Number.MAX_SAFE_INTEGER, MIN_SAFE_INTEGER and EPSILON.
- Pretty-printed object with one nested object — classic json.org pass3.
- Pi to 22 significant digits — precision beyond IEEE-754 double.
- String containing every single-char escape: \b \f \n \r \t \" \\ \/.
- Surrogate-pair escape for emoji alongside BMP escapes.
- Tab and newline characters between tokens — all four JSON whitespace chars.
- BMP escapes plus an emoji surrogate pair (\uD83D\uDE00).
- Raw 4-byte UTF-8 sequences (emoji) mixed with multi-script text.
- Raw UTF-8 for Japanese, Arabic, Chinese plus emoji — no escapes.
- 250-digit mantissa — parser must not truncate.
- Zero in many scientific forms: 0e0, 0e+1, 0e-1, 0.0e0.
Invalid JSON — parser must reject (74)
- Arithmetic expression (1 + 2) used as a value.
- Array used as an object key.
- Invalid \a escape — only \b \f \n \r \t \" \\ \/ \u allowed.
- Backslash followed by a space — not a defined escape.
- String wrapped in backticks — JSON only allows double quotes.
- Minus sign alone, with no digits — [-].
- C-style /* */ block comment — JSON has no comments.
- JSON literals are case-sensitive — "True" is not valid.
- Array element followed by colon — colon is for objects only.
- Trailing comma after the closing array bracket.
- Object member that uses comma where colon belongs.
- Object member with two colons ("k"::v).
- Number containing two decimal points (1.0.0).
- Number containing two exponent markers (1e1e1).
- Exponent with two signs (0e+-1).
- Number with two minus signs (--1).
- Two commas in a row — element omitted between them.
- Number with exponent marker followed by no digits inside an array.
- Number with exponent marker but no exponent digits (0e).
- Number with decimal point but no fraction digits before the exponent (1.e5).
- Empty file — no JSON value present.
- Number with an exponent sign but no digits (0e+).
- Backslash followed by a literal newline — not a valid escape.
- Array followed by an extra ].
- Object followed by another value after the closing brace.
- JavaScript-style function call as a value.
- # character where a value is expected.
- Hex literal 0x14 — not a JSON number.
- Infinity literal — JSON has no infinity.
- Integer used as an object key.
- Comma at the start of an array — implies missing first element.
- Comma at the start of an object — implies missing first member.
- Number with a leading + sign — JSON allows only - or none.
- C++-style // line comment — JSON has no comments.
- Minus sign separated from its digit by a space — [- 1].
- Opens with [ but closes with } — bracket mismatch.
- Object with two quoted strings adjacent and no colon.
- Object member without the : separating key and value.
- Two array values with no comma between them ("[1 2]").
- Object member with key + colon but no value.
- Multi-digit integer starting with zero (00) — disallowed by RFC.
- Large (~100 KB) multilingual record set with a deliberate syntax error.
- Bare identifier following backslash inside array (\naked).
- NaN literal — JSON has no NaN.
- \uXXXX with a non-hex character (G).
- Literal null used as an object key — keys must be strings.
- Number starting with . instead of a digit (.5).
- Number ending in . with no fractional digits (1.).
- Octal-style leading zero followed by more digits (013).
- C-style \017 octal escape — not part of JSON.
- Number prefixed with + inside an array ([+1]).
- Python's None literal — JSON uses null.
- Literal control character (0x01) inside a string.
- Literal newline (0x0A) inside a string — must be \n.
- Literal tab (0x09) inside a string — must be \t.
- String wrapped in ' instead of " — JSON requires double quotes.
- \u with exactly 3 hex digits before the closing quote.
- Trailing comma before the closing array bracket.
- Trailing comma before the closing object brace.
- Valid array followed by stray non-whitespace ("[]x").
- Valid object followed by stray non-whitespace ("{}x").
- \u escape with fewer than 4 hex digits ("\u12").
- Two complete arrays at the root with no separator.
- Two complete objects at the root, separated by space.
- Array missing its closing ].
- Object with a trailing comma and no closing brace.
- Object missing its closing }.
- String missing its closing quote (duplicate guard).
- Underscore used as a digit group separator (1_000) — not JSON syntax.
- Unrecognised identifier "truth" used as a value.
- Object key without quotes — keys must always be strings.
- Uppercase \U escape — only lowercase \u is valid.
- File that contains only whitespace.
- Invalid \x.. escape — JSON has only \u, not \x.
Performance fixtures (1)
- Synthetic ~50 KB document — entry-level perf measurement.
Test suite manifests (4)
-
test-all.json5.1 KBMaster suite — every fixture, including large performance files.
-
test-normal.json4.7 KBFunctional-correctness suite — every pass-/fail- fixture, no large perf files.
-
test-perf.json565 BPerformance benchmark suite — large files only.
-
test-quick.json860 BSmoke test — one fixture per major category, <1 s total.