liveBook · Manning

JSON primitive data type

As explained in Acing the CCNA Exam: Volume 2 Advanced Networking and Security

A JSON primitive data type is one of the fundamental JSON value types: string, number, Boolean, or null.

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

How Acing the CCNA Exam: Volume 2 Advanced Networking and Security covers it

How deep it goes
Distinguishes four primitive forms, quoting, and lowercase requirements without explaining parser internals.
Examples
Uses an interface-status object containing strings, a Boolean, a number, and null.
What it assumes
Assumes basic key-value pair familiarity while defining each primitive type and its syntax.
What you can do after
Evaluate JSON values correctly by checking quotation marks, numeric syntax, Boolean spelling, and null spelling.
How it connects
Connects JSON primitives with serialization, REST APIs, objects, arrays, XML, and YAML.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Acing the CCNA Exam: Volume 2 Advanced Networking and Security. The section links point to the parts of the book it draws on.