In JSON, every key has a value. The value is written after the colon (:).
{
"key": value
}
JSON supports exactly six data types. Every value in JSON must be one of these.
| Type | Example | Description |
|---|---|---|
| String | "hello world" | Text wrapped in double quotes |
| Number | 42, 3.14, -7 | Integer or decimal (no quotes) |
| Boolean | true, false | Logical true/false (no quotes) |
| Null | null | Represents no value (no quotes) |
| Object | { "key": "value" } | Unordered collection of key/value pairs in { } |
| Array | [1, 2, 3] | Ordered list of values in [ ] |
{
"name": "Alice", // string
"age": 30, // number
"isStudent": false, // boolean
"middleName": null, // null
"address": { // object
"city": "New York"
},
"hobbies": ["reading", "art"] // array
}
You can learn about each value type in detail in the following sections.