JSON primitive data types are the four fundamental forms used for values in JSON serialization: string, number, Boolean, and null. Applications use JSON to exchange human-readable data, including through REST APIs. section 24.2.1 section 24.4
Distinguish the types by their syntax and meaning:
- String: text enclosed in double quotes; quoted values such as "5", "true", and "null" remain strings. section 24.2.1
- Number: an unquoted numeric value such as 5 or 101.25. section 24.2.1
- Boolean: exactly true or false, written in lowercase. section 24.2.1
- Null: the lowercase value null, representing the intentional absence of a value. section 24.2.1
Mixed primitive values
A JSON object can combine all four types: an interface name and IP address can be strings, is_up can be the Boolean true, speed can be the number 1000, and description can be null.
{
"interface_name": "GigabitEthernet1/1", #1
"is_up": true, #2
"ip_address": "192.168.1.1", #3
"netmask": "255.255.255.0", #4
"speed": 1000, #5
"description": null #6
}
Inspect the annotated object to compare quoted strings with unquoted numbers, Boolean values, and null. section 24.2.1
