JSON syntax rules
ClientRead how RFC 8259 constrains JSON text, then paste a document to validate with JSON.parse. Invalid input shows the engine error plus short hints for common mistakes—everything stays local.
Learn more: RFC 8259 syntax vs semantics
This page summarizes what “legal JSON text” means under RFC 8259 and ECMA-404: tokens, quotes, whitespace, and what is explicitly not allowed. Use it alongside the live checker to connect rules with parse errors.
What syntax covers
Syntax decides whether a Unicode string can be parsed into a value at all. A document may parse successfully yet be the wrong shape for your application—that is what JSON Schema, codecs, or business rules address downstream.
Common rejections
Strict JSON requires double-quoted keys and string values, no trailing commas, no comments, and only `true`, `false`, `null`, numbers, arrays, objects, and strings at the value level. Many config or hand-edited files look “almost JSON” but include JSON5/JSONC or JavaScript liberties—convert or strip those first.
Syntax vs semantics
Duplicate keys, very large integers, or surprising Unicode normalization are usually semantic concerns: `JSON.parse` may still succeed. Use schema validation or domain rules after syntax passes.
RFC 8259 syntax at a glance(expand rules)
Normative grammar lives in RFC 8259. This checklist matches what JSON.parse enforces in your browser.
- Single JSON valueA document is one value: object, array, string, number, true, false, or null—no extra tokens after it.
- Double-quoted keysEvery object member name is a string in double quotes (`"key"`). Unquoted names are invalid.
- Double-quoted stringsString values use `"` with escapes: `\"`, `\\`, `\/`, `\b`, `\f`, `\n`, `\r`, `\t`, or `\uXXXX`.
- JSON numbersDecimal syntax only: no `0x`, no leading `+`, no `NaN` / `Infinity`, and no unnecessary leading zeros (e.g. `01` is invalid).
- LiteralsOnly `true`, `false`, and `null`—lowercase, unquoted.
- No trailing commasCommas separate elements; a comma must not appear immediately before `}` or `]`.
- No comments`//` and `/* */` are not part of JSON. Use JSON5 / JSONC tools if your source includes them.
- Insignificant whitespaceSpace, tab, LF, and CR may appear between tokens—not inside strings unless escaped.
Validate against JSON syntax rules
?
Uses the browser's JSON.parse (RFC 8259 / ECMA-404). When parsing fails, common mistakes are listed as hints—they are heuristic, not a full parser.
Valid JSON — this text conforms to the syntax rules enforced by JSON.parse.
Root value: object (2 keys)
Pretty-print in the JSON formatter or continue with JSON Schema validation when you need shape checks beyond syntax.
Nearby workflows on Toolcore
- JSON formatter — once syntax parses—pretty-print for tickets and docs.
- JSON5 / JSONC — when the paste still has comments or trailing commas.
- JSON repair — for slightly broken payloads that fail RFC 8259 parse.
Common use cases
- Confirm pasted API or config text is legal JSON before sending it to a strict parser.
- Teach what strict JSON allows compared to JavaScript object literals or JSON5.
- Spot BOMs, trailing commas, or comment syntax that slipped in from editors or generators.
Common mistakes to avoid
Expecting JavaScript extras in JSON
JSON allows only double-quoted strings, no trailing commas, and no `Infinity`, `NaN`, or `undefined`—even if your runtime prints them elsewhere.
Treating schema validation as syntax
Syntax checks whether text parses; JSON Schema checks whether data matches rules. Use both when you need shape and type guarantees.
Relying only on generic error text
Hints here are best-effort. For unclear failures, try the formatter page or the JSON error explainer when you need step-by-step wording.
FAQ
Is this the full RFC 8259 grammar?
No. This page explains the standard in prose and delegates parsing to your browser’s JSON implementation. For the normative spec, see IETF RFC 8259.
Why do hints sometimes miss the real problem?
Heuristics look for frequent patterns (such as trailing commas). They are not a second parser; the authoritative signal remains the parse error message.
Does validation leave my network?
No. Parsing runs in your browser tab; nothing is uploaded for this check.
Can I share a link with my JSON pasted in?
Yes. Use Copy agent link after editing—the URL opens this page with the same text in the editor via q or qb prefill.
Common search terms
Phrases people search for that match this tool. See the full long-tail keyword index.
- json syntax rules rfc 8259
- validate json syntax online
- json.parse error explained
- strict json vs json5
- json trailing comma check
More tools
Related utilities you can open in another tab—mostly client-side.
JSON formatter
ClientJSON format online: pretty-print, minify, validate, escape, download .json.
JSON5 / JSONC → JSON
ClientParse JSON5 and JSON with comments—output strict JSON, pretty or minify in browser.
JSON repair
ClientFix almost-JSON to strict JSON—trailing commas and common mistakes, local only.
JSON & error explainer
AIPaste a parse error or bad JSON; get causes and fix hints—redact secrets; validate in the JSON formatter.