JSON Examples & Common Structures
JSON (JavaScript Object Notation) is the standard data format for APIs and configuration files. Here are real examples of every structure you'll encounter.
Try the Free JSON Formatter & Validator โ
Format, validate, and minify any JSON in the browser
๐ JSON Data Types
| Type | Example | Notes |
|---|---|---|
| String | "Hello, World!" | Always double quotes |
| Number | 42 or 3.14 | No quotes, decimal allowed |
| Boolean | true or false | Lowercase only |
| Null | null | Lowercase only |
| Array | [1, "a", true] | Ordered list, mixed types ok |
| Object | {"key": "value"} | Key always must be a string |
Simple Object
Key-value pairs. The most basic JSON structure.
{
"name": "Alice",
"age": 30,
"isAdmin": false,
"email": "alice@example.com"
}Array of Values
Ordered list. Values can be any JSON type.
["apple", "banana", "cherry", 42, true, null]Nested Object
Objects within objects for hierarchical data.
{
"user": {
"id": 1,
"name": "Bob",
"address": {
"city": "Jakarta",
"country": "Indonesia"
}
}
}Array of Objects
Common pattern for lists of records (API responses).
[
{ "id": 1, "name": "Product A", "price": 9.99 },
{ "id": 2, "name": "Product B", "price": 14.99 },
{ "id": 3, "name": "Product C", "price": 4.99 }
]API Response Pattern
Typical REST API response with status and pagination.
{
"status": "success",
"data": {
"users": [
{ "id": 1, "name": "Alice" },
{ "id": 2, "name": "Bob" }
],
"total": 2,
"page": 1,
"per_page": 10
},
"error": null
}โ ๏ธ Common JSON Mistakes
โ Single quotes โ JSON requires double quotes: use "name" not 'name'
โ Trailing comma โ `{"a": 1,}` is invalid. Remove the last comma.
โ Comments โ JSON does not support // or /* */ comments.
โ Undefined โ JSON has no `undefined` type. Use `null` instead.
โ Unquoted keys โ All object keys must be in double quotes.