Developer Guide
JSON Syntax Cheat Sheet
JSON syntax quick reference: data types, objects, arrays, escaping, and common mistakes. Copy-paste examples for every JSON construct.
A quick reference for JSON syntax. Copy-paste these examples and avoid common mistakes.
Data types
String: "hello" (double quotes required). Number: 42, 3.14, -17, 1e10 (no quotes, no leading zeros). Boolean: true, false (lowercase, no quotes). Null: null (lowercase, no quotes). Object: {"key": "value"}. Array: [1, 2, 3].
Objects
Keys must be strings in double quotes. Values can be any type. {"name": "Alice", "age": 30, "active": true, "address": {"city": "NYC"}}. No trailing commas.
Arrays
Arrays hold ordered values of any type. [1, "two", true, null, {"key": "val"}]. Mixed types are valid. No trailing commas.
Escaping
Quote: \". Backslash: \\. Newline: \n. Tab: \t. Unicode: \uXXXX. Example: {"text": "Line 1\nLine 2"}
Not allowed
No trailing commas. No comments. No single quotes. No unquoted keys. No undefined (use null). No NaN or Infinity (use strings or null). No functions or dates (convert to strings).
Summary
Validate your JSON in the JSON Formatter to catch syntax errors before they reach production.