


We use cookies to improve your experience
We use essential cookies to make our site work. With your consent, we may also use non-essential cookies to improve user experience.
7 sections · 46 items
| Code / Syntax | Description |
|---|---|
"string" | Text wrapped in double quotes |
42 | Integer number |
3.14 | Floating-point number |
-17 | Negative number |
2.5e10 | Scientific notation |
true | Boolean true |
false | Boolean false |
null | Null / empty value |
[1, 2, 3] | Array (ordered list) |
{"key": "value"} | Object (key-value pairs) |
| Code / Syntax | Description |
|---|---|
{ } | Object delimiters |
[ ] | Array delimiters |
"key": value | Key-value pair (keys must be double-quoted strings) |
, | Separator between items (no trailing comma!) |
: | Separator between key and value |
| Code / Syntax | Description |
|---|---|
\" | Double quote |
\\ | Backslash |
\/ | Forward slash |
\n | Newline |
\r | Carriage return |
\t | Tab |
\b | Backspace |
\f | Form feed |
\uXXXX | Unicode character (4 hex digits) |
| Code / Syntax | Description |
|---|---|
{'key': 'val'} | Single quotes are not allowed |
{key: "val"} | Unquoted keys are not allowed |
[1, 2, 3,] | Trailing commas are not allowed |
// comment | Comments are not allowed |
undefined | undefined is not a JSON value |
NaN | NaN is not valid in JSON |
Infinity | Infinity is not valid in JSON |
0x1A | Hex numbers are not valid |
| Code / Syntax | Description |
|---|---|
{"users": [{"name": "Alice"}, {"name": "Bob"}]} | Array of objects |
{"config": {"db": {"host": "localhost"}}} | Nested objects |
[[1,2],[3,4]] | Array of arrays (matrix) |
{"tags": ["js", "react", "next"]} | Array as object value |
| Code / Syntax | Description |
|---|---|
JSON.parse(string) | Parse JSON string to object |
JSON.stringify(obj) | Convert object to JSON string |
JSON.stringify(obj, null, 2) | Pretty-print with 2-space indent |
JSON.stringify(obj, replacer) | Custom serialization with replacer function |
JSON.parse(str, reviver) | Custom parsing with reviver function |
| Code / Syntax | Description |
|---|---|
application/json | MIME type for JSON |
.json | Standard file extension |
.jsonl | JSON Lines (one JSON object per line) |
.geojson | GeoJSON geographic data |
application/ld+json | JSON-LD (linked data / structured data) |