02 Value Types

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.

The Six JSON Types

TypeExampleDescription
String"hello world"Text wrapped in double quotes
Number42, 3.14, -7Integer or decimal (no quotes)
Booleantrue, falseLogical true/false (no quotes)
NullnullRepresents no value (no quotes)
Object{ "key": "value" }Unordered collection of key/value pairs in { }
Array[1, 2, 3]Ordered list of values in [ ]

All Types in One Example

{
    "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.