JSON syntax rules

Client

Read 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.

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.

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.

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

Related utilities you can open in another tab—mostly client-side.