liveBook · Manning

JSON number

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

A JSON number is a numeric value represented without surrounding double quotes.

A JSON number represents a numeric value without surrounding double quotes, such as 5 or 101.25. Double quotes change the value into a string, so "5" is not a JSON number. section 24.2.1

Recognize the type

In {"speed": 1000}, speed has a JSON number value. In {"port": "22"}, port has a string value despite containing digits. This distinction is a common exam trap. section 24.2.1 section 24.2.3

{
  "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 speed: its unquoted value 1000 is numeric, while the quoted interface, address, and mask values are strings. section 24.2.1

JSON uses numbers as one of four primitive data types. Numbers can appear as values within objects or arrays and support data exchanged by applications and REST APIs. section 24.4

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

How deep it goes
Defines numbers and contrasts them with quoted strings, but does not detail numeric grammar or parser behavior.
Examples
Uses 5, 101.25, speed 1000, and quoted port "22" to distinguish numeric and string values.
What it assumes
Assumes familiarity with JSON key-value pairs and teaches the quoted-versus-unquoted type distinction explicitly.
What you can do after
Evaluate JSON values and identify whether digit-containing values are numbers or strings.
How it connects
Connects numbers with strings, Boolean values, null, objects, arrays, and JSON serialization.

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.