Interpreting JSON
The CCNA asks you to read a JSON payload and find the value the question is asking for — an interface status, an IP address, a count. This lesson walks through realistic network API responses line by line so you can navigate nested objects and arrays with confidence.
Anatomy of a JSON document
A JSON document is a single value — usually an object — at the top level. Everything inside is one of six types: string, number, boolean, null, object or array. Two pieces of punctuation do most of the work: curly braces mark objects and square brackets mark arrays. A colon separates a key from its value, and a comma separates entries.
Read it top to bottom: the object has four keys. deviceName maps to the string "edge-router-1"; uptimeSeconds to the number 86400; reachable to the boolean true; and location to null, meaning the value is absent or unknown. Nothing here needs interpretation beyond the type — the skill is knowing which type is which.
{ is a new object and each [ is a new array. Indentation is only for humans — the braces and brackets are what a parser actually uses — but a well-formatted document makes the structure obvious.Navigating to a value
To find a value you follow the path from the top down, naming each key or array index along the way. If the top-level object has a key interfaces whose value is an array, then the third element is interfaces[2] — arrays are zero-indexed. If that element is an object with a key ip, the path is interfaces[2].ip.
interfaces[0].address.Reading an interface list
Here is a realistic response from a network controller’s interfaces endpoint. Read it, then answer the questions underneath.
{
"hostname": "SW1",
"interfaceCount": 3,
"interfaces": [
{ "name": "GigabitEthernet1/0/1", "status": "up", "vlan": 10, "speed": 1000 },
{ "name": "GigabitEthernet1/0/2", "status": "down", "vlan": 10, "speed": 1000 },
{ "name": "GigabitEthernet1/0/3", "status": "up", "vlan": 20, "speed": 100 }
]
}
- What is the hostname? — the value of
hostname, the string"SW1". - How many interfaces are reported? —
interfaceCountis3. You can confirm by counting the objects in theinterfacesarray. - Which interface is down? — scan
interfaces[*].statusfor"down"; it isinterfaces[1], whosenameis"GigabitEthernet1/0/2". - What VLAN is
GigabitEthernet1/0/3in? — the third element,interfaces[2], hasvlan: 20. - What speed is
GigabitEthernet1/0/3running at? —speed: 100, a number (note it is not a string; there are no quotes).
Nested objects and arrays
Real responses nest more deeply. The example below wraps addressing inside each interface, and includes an array of allowed VLANs. This is where careful reading matters, because the same key name (vlan) can appear in different places.
{
"device": "R1",
"interfaces": [
{
"name": "GigabitEthernet0/0",
"status": "up",
"address": { "ip": "10.0.0.1", "mask": "255.255.255.0" },
"trunkVlans": [10, 20, 30]
},
{
"name": "GigabitEthernet0/1",
"status": "administratively down",
"address": null,
"trunkVlans": []
}
]
}
| Question | Path | Answer |
|---|---|---|
| IP of the first interface? | interfaces[0].address.ip | 10.0.0.1 |
| Mask of the first interface? | interfaces[0].address.mask | 255.255.255.0 |
| How many allowed VLANs on the first interface? | interfaces[0].trunkVlans | 3 (10, 20, 30) |
| Why has the second interface no IP? | interfaces[1].address | It is null (no address). |
| What is the second interface’s status? | interfaces[1].status | "administratively down" |
"administratively down", not merely "down". That detail matters: administratively down means the interface was shut by configuration (shutdown), whereas down usually means a physical or protocol problem. Reading the exact string, not a paraphrase, is the whole skill.Interpreting data types
Data type tells you how to compare a value. In the snippets above, vlan: 10 is a number and name: "GigabitEthernet1/0/1" is a string. If an exam option shows "10" in quotes where the document has 10 without quotes, that option has misread the type.
| JSON | Type | Meaning |
|---|---|---|
"up" | String | Text value; could be any word. |
1000 | Number | Numeric value; usable in comparisons. |
true | Boolean | Logical true (no quotes, lowercase). |
null | Null | No value / not present. |
{ ... } | Object | Nested key/value set. |
[ ... ] | Array | Ordered list; may hold objects or scalars. |
One useful consequence: a boolean such as "enabled": true is not the same as the string "true". A well-written client relies on the type, so a response that declares true means the concept is genuinely on, whereas null means it is simply not reported.
Practice walkthrough
Here is a device-inventory response. Try each question before reading the answer.
{
"count": 2,
"devices": [
{ "hostname": "SW1", "role": "access", "mgmtIp": "10.0.1.1", "osVersion": "17.9" },
{ "hostname": "SW2", "role": "access", "mgmtIp": "10.0.1.2", "osVersion": "17.3" }
]
}
- How many devices are listed? The
countis2, and thedevicesarray holds two objects. Answer: 2. - What is the management IP of SW2? Find the element whose
hostnameis"SW2"— that isdevices[1]— then read itsmgmtIp:"10.0.1.2". - Which device runs an older OS? Compare
devices[*].osVersion:"17.9"versus"17.3". SW2 is on the lower version,17.3. (As strings, compare carefully; as software versions, 17.3 is older than 17.9.) - What role do the devices share? Both
rolevalues are"access".
The pattern never changes: find the object, then read the key. Every exam question about JSON comes down to that, plus an awareness of index 0 and of which values are strings versus numbers.
Review
Check what you have learned with these review questions.
| Key term | Meaning |
|---|---|
| JSON object | An unordered set of key/value pairs in curly braces. |
| JSON array | An ordered list of values in square brackets; zero-indexed. |
| Key | The quoted name of a value inside an object. |
| Path | The sequence of keys/indices leading to a value, e.g. interfaces[0].status. |
| String | A double-quoted text value. |
| Number | An unquoted numeric value. |
| Boolean | Unquoted true or false. |
| Null | A JSON value meaning “no value”. |
- Cisco. CCNA (200-301) Exam Topics, Domain 6.0 Automation and Programmability. cisco.com.
- Bray, T. et al. RFC 8259: The JavaScript Object Notation (JSON) Data Interchange Format (2017). rfc-editor.org/rfc/rfc8259.
- ECMA International. ECMA-404: The JSON Data Interchange Syntax. ecma-international.org.
- Cisco. DevNet: Interpreting JSON / REST API Basics. developer.cisco.com.
Sources & references
- Cisco. CCNA (200-301) Exam Topics, Domain 6.0 Automation and Programmability. cisco.com.
- Bray, T. et al. RFC 8259: The JavaScript Object Notation (JSON) Data Interchange Format (2017). rfc-editor.org/rfc/rfc8259.
- ECMA International. ECMA-404: The JSON Data Interchange Syntax. ecma-international.org.
- Cisco. DevNet: Interpreting JSON / REST API Basics. developer.cisco.com.
Target exams: CCNA 200-301 v1.1 · CyberOps Associate 200-201. Last content verification: 2026-10-11.