Format & Validate Documentation

Complete RFC 8259 JSON Specification & Grammar Reference

An authoritative developer reference on official RFC 8259 JSON syntax rules, primitive data types, string escaping, and number encoding.

JSON (JavaScript Object Notation) is governed by IETF RFC 8259 and ECMA-404. It is a lightweight, text-based, language-independent data interchange format.

1. Core Data Types in RFC 8259

RFC 8259 defines six fundamental primitive and structural data types:

  • Objects ({ }): Unordered collections of zero or more key-value pairs. Keys MUST be double-quoted strings.
  • Arrays ([ ]): Ordered sequences of zero or more values of any type.
  • Strings ("..."): Sequences of Unicode code points enclosed in double quotes ("...).
  • Numbers: Signed decimal numbers in standard or scientific exponential notation.
  • Booleans: Keyword literals true or false (strictly lowercase).
  • Null: The keyword literal null.

{
  "name": "JSON2X Enterprise API",
  "version": 2.4,
  "isActive": true,
  "metadata": null,
  "tags": ["developer", "tools", "privacy-first"]
}

2. String Escaping & Special Characters

RFC 8259 mandates backslash (\) escaping for special control characters:

CharacterEscape SequenceDescription
Quotation mark\"Double quote character
Reverse solidus\\Backslash character
Solidus\/Forward slash (optional)
Backspace\bBackspace control code
Form feed\fForm feed control code
Line feed\nStandard Unix newline
Carriage return\rCarriage return
Tab\tHorizontal tab
Unicode code point\uXXXX4-hex digit Unicode hex

3. Strict RFC 8259 Parsing Rules

  • No Single Quotes: Keys and string values must strictly use double quotes ("key": "value").
  • No Trailing Commas: A comma after the final element in an object or array causes a syntax violation.
  • No Unquoted Keys: Property names like { age: 30 } are valid JavaScript object literals, but invalid JSON.
  • No Comments: Comments (// or / /) are prohibited under standard RFC 8259.
  • No Leading Zeros: Numbers like 0123 or +42 are invalid in JSON.

4. Frequently Asked Questions

Why does JSON reject single quotes?

RFC 8259 explicitly standardized on double quotes (") to ensure absolute cross-platform interoperability across all programming language parsers (C, Java, Python, Go, Rust).

How does client-side validation prevent data corruption?

Client-side validation runs in the browser's JavaScript engine before network transmission, preventing invalid payloads from hitting backend databases and APIs.

Put this into practice with the JSON Validator

Runs entirely in your browser — no upload, no signup, and your data never leaves your device.

Open JSON Validator →

Tools referenced in this document

Related Documentation & Reference Articles