A quick reference for JSON syntax rules, supported data types, formatting conventions, and the most common mistakes that cause parsing errors.
| Code / Syntax | Description |
|---|---|
"name" | Strings must use double quotes (not single quotes) |
{"age": 30} | Keys must be double-quoted strings |
[1, 2, 3] | No trailing commas allowed |
(no comments) | Comments (// or /* */) are not allowed |
null | Use null instead of undefined |
| Code / Syntax | Description |
|---|---|
\" | Double quote |
\\ | Backslash |
\/ | Forward slash |
\n | Newline |
\r | Carriage return |
\t | Tab |
\uXXXX | Unicode character |
| Code / Syntax | Description |
|---|---|
"hello" | String — Must be in double quotes |
42 / 3.14 / 2.5e10 | Number — Integer or float, no leading zeros, no hex |
true / false | Boolean — Lowercase only |
null | Null — Lowercase only, represents absence of a value |
{"key": "value"} | Object — Unordered key-value pairs, keys must be unique strings |
[1, "two", true] | Array — Ordered list of values, can contain mixed types |
| Code / Syntax | Description |
|---|---|
Keys | JSON: must be double-quoted strings. JS: can be unquoted identifiers |
Strings | JSON: double quotes only. JS: single or double quotes |
Trailing commas | JSON: not allowed. JS: allowed |
Comments | JSON: not allowed. JS: allowed |
Functions | JSON: not allowed. JS: allowed |
undefined | JSON: not allowed. JS: allowed |
Dates | JSON: stored as strings. JS: native Date objects |
Found this cheat sheet useful? Check out our other references and tools.