Interpreting JSON Encoded Data

22 questions

Question 1Question

A network automation engineer issues an HTTP GET request to a Cisco IOS-XE RESTCONF API endpoint to retrieve BGP neighbor status details. The router returns the following JSON-encoded response:

{
"Cisco-IOS-XE-bgp:bgp-state-data": {
"bgp-neighbors": [
{
"neighbor-id": "192.168.10.1",
"remote-as": 65001,
"state": "Established",
"address-family": [
{
"af-name": "ipv4-unicast",
"prefixes": {
"accepted": 42,
"sent": 15
}
},
{
"af-name": "vpnv4-unicast",
"prefixes": {
"accepted": 120,
"sent": 88
}
}
]
},
{
"neighbor-id": "192.168.20.2",
"remote-as": 65002,
"state": "Active",
"address-family": [
{
"af-name": "ipv4-unicast",
"prefixes": {
"accepted": 0,
"sent": 0
}
}
]
}
]
}
}

Match each Python dictionary lookup / data extraction expression on the left to its corresponding value or evaluated data type on the right based on the JSON response payload.

Click a left item, then click its matching right item

Items

data["Cisco-IOS-XE-bgp:bgp-state-data"]["bgp-neighbors"][0]["address-family"][1]["prefixes"]["accepted"]
data["Cisco-IOS-XE-bgp:bgp-state-data"]["bgp-neighbors"][1]["remote-as"]
type(data["Cisco-IOS-XE-bgp:bgp-state-data"]["bgp-neighbors"][0]["neighbor-id"])
data["Cisco-IOS-XE-bgp:bgp-state-data"]["bgp-neighbors"][0]["address-family"][0]["af-name"]

Matches

Show answer & explanation

Answer

Each Python expression correctly matches its evaluated output: the nested lookup for the second address family accepted prefixes of neighbor 0 evaluates to 120; the remote-as of neighbor 1 evaluates to integer 65002; the data type of the quoted neighbor-id string evaluates to str; and the first address family name of neighbor 0 evaluates to "ipv4-unicast".
Each expression matches its exact JSON path evaluation according to zero-based array indexing rules and standard JSON data type mapping into Python data structures (objects to dictionaries, lists to arrays, quoted values to strings, unquoted numbers to integers).

Step-by-Step Solution

1
Parse the top-level JSON structure and array indices using zero-based index rules.
Neighbor array index [0] corresponds to neighbor '192.168.10.1'. Neighbor array index [1] corresponds to neighbor '192.168.20.2'.
JSON arrays listed under brackets [] in Python parsing are zero-indexed.
2
Trace nested path queries down into key-value pairs and inner arrays.
Path 1 selects neighbor [0] ('192.168.10.1'), address-family array index [1] ('vpnv4-unicast'), and extracts key 'accepted' with value 120. Path 2 selects neighbor [1] ('192.168.20.2') and extracts key 'remote-as' with value 65002.
Proper path traversal requires following object keys ({}) and array indices ([]) sequentially.
3
Distinguish between JSON primitive types (string vs number/integer).
'neighbor-id' value "192.168.10.1" is enclosed in quotes (string), whereas 'remote-as' value 65002 is unquoted (integer).
JSON represents strings in double quotes and numbers without quotes.

Key Concept

JSON data structure traversal and type interpretation (arrays, objects, strings, integers)
Question 2Question

A network automation engineer sends an HTTP GET request to a Cisco IOS XE RESTCONF endpoint to check IP SLA operation status. The API returns the following JSON payload:

{
"Cisco-IOS-XE-sla:sla": {
"ip-sla": [
{
"oper-id": 101,
"type": "icmp-echo",
"destination": "192.168.50.1",
"stats": {
"rtt-ms": 14,
"state": "active",
"history": [
{"sample-id": 1, "rtt": 12, "success": true},
{"sample-id": 2, "rtt": 16, "success": true}
]
}
},
{
"oper-id": 102,
"type": "udp-jitter",
"destination": "10.10.20.5",
"stats": {
"rtt-ms": 4,
"state": "inactive",
"history": [
{"sample-id": 1, "rtt": 4, "success": false}
]
}
}
]
}
}

Based on the JSON payload provided above, match each data extraction path on the left to its correct extracted value and data type on the right.

Click a left item, then click its matching right item

Items

`Cisco-IOS-XE-sla:sla` → `ip-sla[0]` → `stats` → `state`
`Cisco-IOS-XE-sla:sla` → `ip-sla[1]` → `destination`
`Cisco-IOS-XE-sla:sla` → `ip-sla[0]` → `stats` → `history[1]` → `rtt`
`Cisco-IOS-XE-sla:sla` → `ip-sla[1]` → `stats` → `history[0]` → `success`

Matches

Show answer & explanation

Answer

The correct matches map each zero-indexed JSON array path to its corresponding value and type: `ip-sla[0]->stats->state` maps to `"active" (String)`, `ip-sla[1]->destination` maps to `"10.10.20.5" (String)`, `ip-sla[0]->stats->history[1]->rtt` maps to `16 (Number)`, and `ip-sla[1]->stats->history[0]->success` maps to `false (Boolean)`.
All four extraction paths correctly evaluate zero-based array indices (`[0]` for first element, `[1]` for second element) and trace object key structures to their exact primitive values and data types.

Step-by-Step Solution

1
Locate top-level keys and array indices
The top-level key `Cisco-IOS-XE-sla:sla` contains an array named `ip-sla`. Index `[0]` refers to the first object (`oper-id` 101), and index `[1]` refers to the second object (`oper-id` 102).
JSON arrays use zero-based indexing, where the first element is at index 0.
2
Extract direct keys from array elements
For `ip-sla[0] -> stats -> state`, the value is `"active"`. For `ip-sla[1] -> destination`, the value is `"10.10.20.5"`.
Navigating directly through key-value maps yields the string values bound to those keys.
3
Traverse nested array elements and primitives
For `ip-sla[0] -> stats -> history[1] -> rtt`, index `[1]` of `history` points to sample-id 2, returning `16`. For `ip-sla[1] -> stats -> history[0] -> success`, index `[0]` points to sample-id 1, returning `false`.
Properly indexing sub-arrays prevents off-by-one errors and identifies data types such as numbers vs. booleans.

Key Concept

Traversing nested JSON objects and zero-indexed arrays returned by Cisco REST APIs.
Question 3Question

An automation script executes an HTTP GET request to a Cisco RESTCONF API endpoint. The router responds with the following JSON payload:

{
"ietf-interfaces:interface": {
"name": "GigabitEthernet1",
"description": "Uplink to Core",
"type": "iana-if-type:ethernetCsmacd",
"enabled": true,
"ietf-ip:ipv4": {
"address": [
{
"ip": "192.168.1.1",
"netmask": "255.255.255.0"
}
]
}
}
}

What is the value of the "description" key in this interface configuration?

Show answer & explanation

Answer: Uplink to Core

Answer

Uplink to Core
In the provided JSON object, the string key 'description' maps directly to the value 'Uplink to Core'.

Step-by-Step Solution

1
Locate the key named "description" within the root "ietf-interfaces:interface" JSON object.
The key "description" is identified in the object.
JSON formatted data maps unique key strings to corresponding values using colons.
2
Extract the string value assigned after the colon for the "description" key.
The value extracted is "Uplink to Core".
The string enclosed in quotes following "description": represents the value.

Key Concept

JSON Key-Value Pair Extraction
Question 4Question

A network technician uses a REST API call to retrieve VLAN configuration data from a Cisco switch. The device returns the following JSON payload:

{
"response": {
"vlan_list": [
{
"vlan_id": 10,
"name": "Management",
"active": true
},
{
"vlan_id": 20,
"name": "Engineering",
"active": false
}
],
"total_vlans": 2
}
}

Based on this JSON payload, which of the following statements are correct? (Select TWO.)

Select all that apply

Show answer & explanation

Answer: The key "vlan_list" contains an array of JSON objects enclosed in square brackets.; The value for the key "active" in the "Engineering" VLAN object is an unquoted boolean data type.

Answer

The key "vlan_list" contains an array of JSON objects, and the value for "active" in the Engineering VLAN is a boolean data type.
The payload uses square brackets `[]` under `vlan_list` to represent an array of objects. Additionally, the value `false` assigned to `active` is unquoted, which correctly identifies it as a native JSON boolean data type.

Step-by-Step Solution

1
Inspect the syntax following the key "vlan_list".
The value starts with square brackets `[ ... ]`, which defines a JSON array containing two curly-brace `{ ... }` dictionary objects.
Square brackets signify arrays in JSON, whereas curly braces denote standalone key-value objects.
2
Analyze the data type assigned to the key "active" inside the second array item.
The second object has `"name": "Engineering"` and `"active": false` without quotation marks around `false`.
Unquoted `true` or `false` values represent boolean data types in JSON syntax.
3
Evaluate the remaining keys and data types.
`"total_vlans": 2` contains an unquoted numerical value (integer), not a string.
String values in JSON must always be wrapped in double quotes (e.g., `"2"`).

Key Concept

Interpreting JSON syntax elements including arrays, objects, strings, numbers, and boolean data types.
Question 5Question

A network administrator receives the following JSON payload from a Cisco DNA Center REST API request:

{
"response": [
{
"hostname": "Switch-Core-01",
"managementIp": "10.1.10.1"
},
{
"hostname": "Switch-Access-01",
"managementIp": "10.1.20.15"
}
]
}

What is the value of `response[1]["managementIp"]` in this JSON structure?

Show answer & explanation

Answer: "10.1.20.15"

Answer

The value of `response[1]["managementIp"]` is "10.1.20.15".
JSON uses 0-based indexing for array structures defined by square brackets (`[]`). The key `"response"` maps to an array containing two objects. The first element at index `0` corresponds to `Switch-Core-01`, and the second element at index `1` corresponds to `Switch-Access-01`. Accessing key `"managementIp"` on the second element yields `"10.1.20.15"`.

Step-by-Step Solution

1
Locate the top-level key named "response".
The key "response" contains an array holding two object structures.
Top-level access requires locating the target key first.
2
Apply the array index [1] using 0-based indexing.
Index [0] corresponds to the first object (Switch-Core-01), while index [1] targets the second object (Switch-Access-01).
JSON arrays use 0-based indexing.
3
Extract the value associated with the key "managementIp" from the second object.
The key "managementIp" maps to the string value "10.1.20.15".
Accessing the key within the targeted dictionary/object yields its corresponding value.

Key Concept

JSON Data Structure Traversal and Zero-Based Array Indexing
Question 6Question

A network automation script executes a REST API call to a Cisco SD-WAN vManage controller to retrieve operational statistics. The API returns the following JSON payload:

{
"system_status": {
"controller_group": "Group-Alpha",
"devices": [
{
"hostname": "vEdge-Branch1",
"site_id": 100,
"reachability": "reachable",
"tunnel_stats": [
{"color": "biz-internet", "latency_ms": 12},
{"color": "mpls", "latency_ms": 8}
]
},
{
"hostname": "vEdge-Branch2",
"site_id": 200,
"reachability": "unreachable",
"tunnel_stats": [
{"color": "biz-internet", "latency_ms": 45}
]
}
]
}
}

Assuming the response is stored in a Python dictionary named `payload`, which data path expression correctly extracts the integer value `8` representing the MPLS tunnel latency for `vEdge-Branch1`?

Show answer & explanation

Answer: payload["system_status"]["devices"][0]["tunnel_stats"][1]["latency_ms"]

Answer

The expression `payload["system_status"]["devices"][0]["tunnel_stats"][1]["latency_ms"]` correctly extracts the integer value 8.
The correct expression accurately navigates the nested JSON hierarchy. The top-level key 'system_status' maps to an object containing the key 'devices', which holds an array (list). Index 0 retrieves the first device ('vEdge-Branch1'). Within that device dictionary, 'tunnel_stats' holds another array. Index 1 retrieves the second tunnel entry ('mpls'), and the key 'latency_ms' yields the value 8.

Step-by-Step Solution

1
Locate the top-level object key 'system_status'
Accesses the object containing 'controller_group' and the 'devices' array.
Top-level JSON element is a dictionary object containing 'system_status'.
2
Access the first element of the 'devices' array
References index [0] to select the dictionary object for 'vEdge-Branch1'.
JSON arrays use zero-based indexing; index 0 represents the first element.
3
Locate the 'tunnel_stats' key within the selected device dictionary
Retrieves the list of tunnel statistics dictionary objects.
'tunnel_stats' contains an array of objects enclosed in square brackets [].
4
Select the second element of the 'tunnel_stats' array and extract 'latency_ms'
Index [1] selects `{"color": "mpls", "latency_ms": 8}`, and key `["latency_ms"]` yields `8`.
Zero-based index 1 points to the second element in the array.

Key Concept

JSON Nested Data Structures and Zero-Based Array Indexing
Question 7Question

A network engineer performs an HTTP GET request to a Cisco IOS XE RESTCONF interface configuration endpoint. The server returns the following JSON payload:

{
"ietf-interfaces:interfaces": {
"interface": [
{
"name": "GigabitEthernet0/0/0",
"type": "iana-if-type:ethernetCsmacd",
"enabled": "true",
"ietf-ip:ipv4": {
"address": [
{
"ip": "192.168.10.1",
"netmask": "255.255.255.0"
}
]
}
},
{
"name": "GigabitEthernet0/0/1",
"type": "iana-if-type:ethernetCsmacd",
"enabled": false,
"ietf-ip:ipv4": {
"address": [
{
"ip": "10.0.1.1",
"netmask": "255.255.255.252"
}
]
}
}
]
}
}

Which TWO statements accurately interpret the structure and data types in this JSON payload?

Select all that apply

Show answer & explanation

Answer: The key path payload["ietf-interfaces:interfaces"]["interface"][0]["enabled"] evaluates to a String data type rather than a Boolean primitive.; The path expression payload["ietf-interfaces:interfaces"]["interface"][1]["ietf-ip:ipv4"]["address"][0]["ip"] resolves to the IP address "10.0.1.1".

Answer

The statement identifying the 'enabled' key in the first interface as a String data type and the path navigating to '10.0.1.1' using array index [1] and address index [0] are both correct.
The option noting that the 'enabled' key contains a String is correct because the value is enclosed in quotes ("true"). The option identifying the path to '10.0.1.1' is correct because index [1] accesses the second interface (GigabitEthernet0/0/1) in zero-indexed JSON array navigation.

Step-by-Step Solution

1
Analyze data types for the 'enabled' key in GigabitEthernet0/0/0.
The value is wrapped in double quotes ("true"), signifying a string primitive in JSON syntax, unlike GigabitEthernet0/0/1 which uses an unquoted boolean literal (false).
Quotations differentiate string values from boolean keywords in JSON parsing.
2
Trace the array index and dictionary path to locate IP address '10.0.1.1'.
The root dictionary has key 'ietf-interfaces:interfaces' -> key 'interface' (list) -> index [1] (second element GigabitEthernet0/0/1) -> key 'ietf-ip:ipv4' (object) -> key 'address' (list) -> index [0] (first element) -> key 'ip' returns '10.0.1.1'.
JSON arrays start at index 0, so index 1 selects the second item in the list.
3
Evaluate the remaining choices against JSON syntax rules.
The 'address' key holds square brackets [], which denote a list/array, not a dictionary object {}. Index [0] on 'interface' yields GigabitEthernet0/0/0, not GigabitEthernet0/0/1.
Square brackets define ordered arrays and zero-indexing governs list positioning.

Key Concept

Interpreting JSON Encoded Data Types and Nested Structure Navigation
Estimated Time:2m 0s
Question 8Question

An automated Python monitoring script sends a RESTCONF HTTP GET request to a Cisco IOS XE router to inspect BGP peer relationships. The JSON response is parsed into a Python dictionary named `bgp_data` as shown below:

{
"Cisco-IOS-XE-bgp:bgp": {
"bgp": [
{
"asn": 65001,
"neighbor": [
{
"ip": "10.1.1.2",
"remote-as": 65002,
"state": "Established"
},
{
"ip": "10.2.2.2",
"remote-as": 65003,
"state": "Active"
}
]
}
]
}
}

Which Python expression correctly evaluates to the string `"Active"`?

Show answer & explanation

Answer: bgp_data["Cisco-IOS-XE-bgp:bgp"]["bgp"][0]["neighbor"][1]["state"]

Answer

bgp_data["Cisco-IOS-XE-bgp:bgp"]["bgp"][0]["neighbor"][1]["state"]
The correct expression traverses the top-level dictionary key `"Cisco-IOS-XE-bgp:bgp"`, selects the single element in the `"bgp"` array using index `0`, accesses the second object in the `"neighbor"` array using index `1`, and reads the string value associated with the `"state"` key, correctly yielding `"Active"`.

Step-by-Step Solution

1
Identify the top-level dictionary key
Access `bgp_data["Cisco-IOS-XE-bgp:bgp"]`, which contains a dictionary with the key `"bgp"`.
Top-level object wrapping is used in YANG-modeled RESTCONF JSON payloads.
2
Navigate the outer array
Access `["bgp"][0]` to reference the first BGP process structure in the list.
Square brackets `[]` signify a JSON array, which is zero-indexed in Python.
3
Locate the target neighbor within the inner array
Access `["neighbor"][1]["state"]` to retrieve the second neighbor object (`10.2.2.2`) and extract its state value.
The first neighbor (`10.1.1.2`) is at index 0, so the second neighbor (`10.2.2.2`) with state `"Active"` is at index 1.

Key Concept

Traversing nested JSON dictionaries and zero-indexed arrays in REST API responses
Estimated Time:1m 0s
Question 9Question

A network engineer issues a RESTCONF GET request to a Cisco IOS XE router to inspect interface operational state data. The API returns the following JSON payload, which is parsed into a Python dictionary named `payload`:

{
"ietf-interfaces:interfaces-state": {
"interface": [
{
"name": "GigabitEthernet1",
"type": "iana-if-type:ethernetCsmacd",
"oper-status": "up",
"phys-address": "00:50:56:89:a1:b2",
"speed": 1000000000
},
{
"name": "GigabitEthernet2",
"type": "iana-if-type:ethernetCsmacd",
"oper-status": "down",
"phys-address": "00:50:56:89:a1:c3",
"speed": 100000000
}
]
}
}

Match each Python dictionary lookup expression on the left with its evaluated value on the right.

Click a left item, then click its matching right item

Items

payload["ietf-interfaces:interfaces-state"]["interface"][0]["oper-status"]
payload["ietf-interfaces:interfaces-state"]["interface"][1]["speed"]
payload["ietf-interfaces:interfaces-state"]["interface"][1]["oper-status"]
payload["ietf-interfaces:interfaces-state"]["interface"][0]["speed"]

Matches

Show answer & explanation

Answer

The correct pairings match expression index [0] to GigabitEthernet1 values ('up' and 1000000000) and index [1] to GigabitEthernet2 values ('down' and 100000000).
In Python, JSON arrays are represented as lists, which use zero-based indexing. The expression referencing index [0] targets the first interface entry ('GigabitEthernet1'), where 'oper-status' is 'up' and 'speed' is 1000000000. The expression referencing index [1] targets the second interface entry ('GigabitEthernet2'), where 'oper-status' is 'down' and 'speed' is 100000000.

Step-by-Step Solution

1
Locate the outer key path
Accessing payload['ietf-interfaces:interfaces-state']['interface'] retrieves a JSON array containing two interface dictionary objects.
JSON arrays are zero-indexed list structures in Python.
2
Evaluate index [0] dictionary key queries
Index [0] corresponds to GigabitEthernet1. Fetching 'oper-status' yields 'up' and fetching 'speed' yields 1000000000.
Array position 0 accesses the first element in the interface array.
3
Evaluate index [1] dictionary key queries
Index [1] corresponds to GigabitEthernet2. Fetching 'speed' yields 100000000 and fetching 'oper-status' yields 'down'.
Array position 1 accesses the second element in the interface array.

Key Concept

Interpreting JSON Encoded Data and Indexing Nested Structures in Automation Scripts
Question 10Question

A network technician parses telemetry data returned by a Cisco vManage REST API call stored in a Python dictionary variable named `telemetry_data`:

{
"header": {
"generated_at": 1690000000,
"status": "success"
},
"data": [
{
"device_id": "10.10.10.1",
"interfaces": [
{
"name": "GigabitEthernet1",
"rx_errors": 0,
"tx_errors": 12,
"status": "up"
},
{
"name": "GigabitEthernet2",
"rx_errors": 45,
"tx_errors": 3,
"status": "up"
}
]
},
{
"device_id": "10.10.10.2",
"interfaces": [
{
"name": "GigabitEthernet1",
"rx_errors": 108,
"tx_errors": 0,
"status": "down"
}
]
}
]
}

What specific value is extracted when referencing `telemetry_data["data"][1]["interfaces"][0]["rx_errors"]`?

Show answer & explanation

Answer: 108

Answer

108
JSON arrays use 0-based indexing. Traversing `telemetry_data["data"][1]` selects the second device entry (`device_id: "10.10.10.2"`). Navigating into its `"interfaces"` array at index `[0]` selects the dictionary for `GigabitEthernet1`. Evaluating the key `"rx_errors"` yields the value `108`.

Step-by-Step Solution

1
Locate the top-level key "data" in the JSON object.
Returns an array containing two device objects.
The key "data" maps directly to an array of objects.
2
Access index 1 of the "data" array.
Selects the second device object with device_id "10.10.10.2".
JSON arrays are 0-indexed; index 1 specifies the second item.
3
Locate the key "interfaces" within the second device object.
Returns an array containing one interface object for GigabitEthernet1.
The key "interfaces" maps to a list of interface dictionaries for this device.
4
Access index 0 of the "interfaces" array and retrieve the value of key "rx_errors".
Retrieves the value 108.
Index 0 refers to the first interface object, where the key "rx_errors" holds the numeric value 108.

Key Concept

JSON Data Traversal and Array Indexing
Estimated Time:1m 0s
Question 11Question

A network administrator issues a RESTCONF HTTP GET request to retrieve OSPF interface parameters from a Cisco IOS XE router. The API returns the following JSON payload:

{
"Cisco-IOS-XE-ospf:ospf": {
"process": [
{
"id": 1,
"area": [
{
"area-id": 0,
"interface": [
{
"name": "GigabitEthernet1",
"cost": 10,
"passive": false
},
{
"name": "GigabitEthernet2",
"cost": 100,
"passive": true
}
]
}
]
}
]
}
}

Based on the JSON payload provided, which two statements correctly interpret the structural data and values? (Select two.)

Select all that apply

Show answer & explanation

Answer: The key "process" maps to a JSON array containing objects that represent OSPF process configurations.; The data path Cisco-IOS-XE-ospf:ospf -> process[0] -> area[0] -> interface[1] -> passive evaluates to the boolean value true.

Answer

The statement identifying that the key 'process' maps to a JSON array of process objects, and the statement evaluating the path to interface[1] -> passive as the boolean literal true are both correct.
The key 'process' uses square brackets `[]` which denotes a JSON array containing configuration objects. The path leading to `interface[1]` correctly targets the second interface object (`GigabitEthernet2`) due to 0-based array indexing, where the `passive` field holds the unquoted boolean value `true`.

Step-by-Step Solution

1
Analyze JSON structural symbols for the key 'process'
The value following "process": is enclosed in square brackets `[...]`, indicating a JSON array.
Square brackets define an ordered list/array of values or objects in JSON syntax.
2
Evaluate array indexing for the 'interface' element list
Index 0 points to GigabitEthernet1 (first element) and Index 1 points to GigabitEthernet2 (second element).
JSON arrays use 0-based indexing where array[0] represents the first element.
3
Inspect data types for 'cost' and 'passive'
The cost value 10 is numeric (no double quotes), while passive values `false` and `true` are unquoted booleans.
JSON string data types require surrounding double quotes, whereas numbers and booleans are written without quotes.

Key Concept

JSON Structure and Data Types (Arrays vs. Objects, 0-based Indexing, and Value Types)
Estimated Time:1m 30s
Question 12Question

A network automation script issues a RESTCONF HTTP GET request to a Cisco IOS XE router to inspect interface configurations. The API returns the following JSON response payload stored in a Python dictionary variable named `result`:

{
"ietf-interfaces:interfaces": {
"interface": [
{
"name": "Loopback0",
"description": "Router ID Interface",
"enabled": true,
"ietf-ip:ipv4": {
"address": [
{
"ip": "192.168.255.1",
"netmask": "255.255.255.255"
}
]
}
},
{
"name": "GigabitEthernet0/0/0",
"description": "WAN Link",
"enabled": false,
"ietf-ip:ipv4": {
"address": [
{
"ip": "10.0.12.1",
"netmask": "255.255.255.252"
}
]
}
}
]
}
}

Which Python expression correctly retrieves the IP address string `"10.0.12.1"` from the `result` dictionary?

Show answer & explanation

Answer: result["ietf-interfaces:interfaces"]["interface"][1]["ietf-ip:ipv4"]["address"][0]["ip"]

Answer

The expression result["ietf-interfaces:interfaces"]["interface"][1]["ietf-ip:ipv4"]["address"][0]["ip"] correctly accesses the IPv4 address string.
The JSON structure contains nested dictionaries and lists. The key 'ietf-interfaces:interfaces' points to an object, whose 'interface' key points to a list of interface objects. 'GigabitEthernet0/0/0' is the second element in this list, which corresponds to index 1. Inside that interface dictionary, 'ietf-ip:ipv4' maps to another dictionary containing the key 'address'. The value of 'address' is a single-element list containing an IP configuration object, so index 0 is required before accessing the 'ip' string key.

Step-by-Step Solution

1
Locate the top-level object key and the nested interface array.
Accessing result["ietf-interfaces:interfaces"]["interface"] yields a Python list containing two interface dictionary objects.
Brackets [...] in JSON denote arrays, which map to lists in Python.
2
Identify the index of GigabitEthernet0/0/0 within the interface array.
Loopback0 is at index 0, and GigabitEthernet0/0/0 is at index 1.
Python uses zero-based indexing for list items.
3
Traverse the nested dictionary keys and the address array.
Accessing ["ietf-ip:ipv4"]["address"] yields a list with one dictionary entry, accessed via index [0], followed by key ["ip"] to retrieve "10.0.12.1".
Since 'address' is enclosed in square brackets in the JSON structure, it must be indexed as a list before selecting the 'ip' key.

Key Concept

Interpreting nested JSON data structures (objects vs. arrays) and using zero-based Python indexing to extract key values.
Question 13Question

A network automation engineer issues a REST API call to a Cisco Catalyst 9800 Wireless LAN Controller to inspect access point operational telemetry. The controller returns the following JSON encoded response:

{
"response": {
"access_points": [
{
"name": "AP-Lobby-01",
"ip_address": "10.20.40.15",
"radios": [
{ "radio_id": 0, "band": "2.4GHz", "channel": 6, "admin_state": true },
{ "radio_id": 1, "band": "5GHz", "channel": 36, "admin_state": true }
]
},
{
"name": "AP-Conf-02",
"ip_address": "10.20.40.16",
"radios": [
{ "radio_id": 0, "band": "2.4GHz", "channel": 11, "admin_state": false },
{ "radio_id": 1, "band": "5GHz", "channel": 149, "admin_state": true }
]
}
]
}
}

Match each JSON data path expression on the left to its corresponding value on the right based on the returned JSON payload.

Click a left item, then click its matching right item

Items

response.access_points[0].radios[1].channel
response.access_points[1].ip_address
response.access_points[1].radios[0].admin_state
response.access_points[0].name

Matches

Show answer & explanation

Answer

Path response.access_points[0].radios[1].channel maps to 36; response.access_points[1].ip_address maps to "10.20.40.16"; response.access_points[1].radios[0].admin_state maps to false; response.access_points[0].name maps to "AP-Lobby-01".
JSON arrays utilize 0-based indexing. Navigating response.access_points[0] accesses the first access point ('AP-Lobby-01'), and navigating inside its radios array with [1] accesses the second radio (5GHz), yielding channel 36. Similarly, access_points[1] selects the second access point ('AP-Conf-02'), yielding an ip_address of "10.20.40.16" and radios[0].admin_state of false. Finally, access_points[0].name yields "AP-Lobby-01".

Step-by-Step Solution

1
Understand zero-based list indexing in JSON structures
Index 0 refers to the first element in an array, while index 1 refers to the second element.
JSON arrays are 0-indexed sequences of items.
2
Trace response.access_points[0].radios[1].channel
Under 'response', enter 'access_points[0]' (first AP: AP-Lobby-01), then enter 'radios[1]' (second radio: 5GHz radio object), then read key 'channel' which equals 36.
Navigating nested object keys and array indices retrieves the specific scalar value.
3
Trace response.access_points[1].ip_address
Under 'response', enter 'access_points[1]' (second AP: AP-Conf-02), and read key 'ip_address' which equals "10.20.40.16".
Index 1 targets the second item in the access_points array.
4
Trace response.access_points[1].radios[0].admin_state
Under 'response', enter 'access_points[1]' (second AP: AP-Conf-02), enter 'radios[0]' (first radio: 2.4GHz radio object), and read key 'admin_state' which equals false.
Index 0 targets the first element of the radios array inside the second access point.
5
Trace response.access_points[0].name
Under 'response', enter 'access_points[0]' (first AP: AP-Lobby-01), and read key 'name' which equals "AP-Lobby-01".
Index 0 targets the top-level array's first dictionary element.

Key Concept

Interpreting JSON Encoded Data
Question 14Question

An automation script retrieves the following JSON response payload from a Cisco Catalyst Center system health API endpoint and stores it in a Python dictionary variable named `health_data`:

{
"response": {
"overallHealth": 85,
"issueList": [
{
"issueId": "ISSUE-101",
"severity": "HIGH",
"impactedEntities": [
{"name": "GigabitEthernet1/0/1", "type": "Interface"},
{"name": "GigabitEthernet1/0/2", "type": "Interface"}
]
},
{
"issueId": "ISSUE-102",
"severity": "LOW",
"impactedEntities": [
{"name": "PowerSupply1", "type": "Power"}
]
}
]
}
}

Which two of the following statements regarding the structure and extraction of data from this JSON payload are correct?

Select all that apply

Show answer & explanation

Answer: The expression health_data["response"]["issueList"][0]["impactedEntities"][1]["name"] evaluates to the string "GigabitEthernet1/0/2".; The value corresponding to the key "overallHealth" is an integer data type, whereas the value of "severity" is a string data type.

Answer

The correct statements are that the path health_data["response"]["issueList"][0]["impactedEntities"][1]["name"] evaluates to "GigabitEthernet1/0/2", and that "overallHealth" contains an integer value while "severity" contains a string value.
The expression health_data["response"]["issueList"][0]["impactedEntities"][1]["name"] correctly navigates through zero-indexed lists and key-value dictionaries to reach "GigabitEthernet1/0/2". Furthermore, 85 is an unquoted integer literal whereas "HIGH" is enclosed in double quotes, confirming integer and string data types respectively.

Step-by-Step Solution

1
Trace the nested JSON array and dictionary key indices for element extraction.
`health_data["response"]["issueList"][0]` references the first issue dictionary ("ISSUE-101"). Inside this dictionary, `["impactedEntities"]` is a list containing two elements. Index `[1]` points to the second element `{"name": "GigabitEthernet1/0/2", "type": "Interface"}`. Accessing key `["name"]` extracts `"GigabitEthernet1/0/2"`.
Lists in JSON map to Python zero-indexed lists, where index 0 is the first element and index 1 is the second element.
2
Analyze JSON primitive data types based on syntax representation.
The value `85` is written without quotes and represents a JSON number (parsed as a Python `int`). The value `"HIGH"` is wrapped in double quotes, representing a JSON string.
JSON distinguishes primitive types such as numbers, strings, booleans, arrays, and objects based on literal formatting.
3
Evaluate the incorrect choices to identify structural and indexing errors.
Accessing `health_data["response"]["issueList"][1]["impactedEntities"][0]` returns the entire dictionary object `{"name": "PowerSupply1", "type": "Power"}`, not just the string value. Accessing index `[1]` on `impactedEntities` of issue `ISSUE-102` attempts to access a non-existent second element, raising an out-of-bounds `IndexError`.
Misinterpreting dictionary objects as raw values or exceeding zero-indexed list bounds causes structural extraction errors.

Key Concept

Interpreting JSON data structures (objects vs arrays), zero-based indexing, and primitive data types in REST API payloads.
Question 15Question

A network administrator parses a JSON response payload from a Cisco Catalyst Center API call stored in a Python dictionary variable named `inventory_data`:

{
"response": [
{
"hostname": "Core-SW-01",
"platformId": "C9300-48U",
"upTimeMinutes": 21600,
"stackMembers": ["Core-SW-01A", "Core-SW-01B"]
},
{
"hostname": "Dist-SW-01",
"platformId": "C9200-24P",
"upTimeMinutes": 61200,
"stackMembers": ["Dist-SW-01A"]
}
],
"version": "1.0"
}

Which Python expression correctly extracts the string value `'Core-SW-01B'` from the payload?

Show answer & explanation

Answer: inventory_data["response"][0]["stackMembers"][1]

Answer

inventory_data["response"][0]["stackMembers"][1]
The key 'response' maps to a JSON array (list). The first element at index 0 is the object representing the device 'Core-SW-01'. Within this object, the key 'stackMembers' holds another array of strings. Because Python lists use zero-based indexing, the second item 'Core-SW-01B' is located at index 1. Therefore, `inventory_data["response"][0]["stackMembers"][1]` correctly extracts the target value.

Step-by-Step Solution

1
Locate the outer key pointing to the target array
`inventory_data["response"]` yields a list of dictionary objects representing switches.
The root object contains a top-level key named 'response'.
2
Select the correct switch object from the list using 0-based indexing
`inventory_data["response"][0]` selects the first dictionary object containing 'Core-SW-01'.
Python list indices start at 0, making index 0 the target for the first switch in the response array.
3
Navigate to the nested array and select the target element
`inventory_data["response"][0]["stackMembers"][1]` evaluates to 'Core-SW-01B'.
Accessing key 'stackMembers' returns a list, and index 1 retrieves the second element within that list.

Key Concept

JSON Array and Object Traversal using Python Indexing
Estimated Time:1m 15s
Question 16Question

A Python script queries a Cisco Catalyst Center API endpoint for network device inventory and stores the resulting data structure in a variable named `data`. The JSON payload structure is shown below:

{
"response": {
"devices": [
{
"id": "dev-101",
"role": "DISTRIBUTION",
"mgmt_ip": "10.1.10.1"
},
{
"id": "dev-102",
"role": "ACCESS",
"mgmt_ip": "10.1.20.1"
}
],
"totalCount": 2
}
}

Which Python expression correctly extracts the management IP address of the ACCESS role device?

Show answer & explanation

Answer: data["response"]["devices"][1]["mgmt_ip"]

Answer

data["response"]["devices"][1]["mgmt_ip"] correctly extracts the management IP address "10.1.20.1".
The JSON structure consists of a outer dictionary with a key named "response", which contains another dictionary with a key named "devices". The value of "devices" is a list (array) of dictionaries. In Python, list indexing begins at 0. Therefore, the first element (DISTRIBUTION device) is at index 0, and the second element (ACCESS device) is at index 1. Accessing the "mgmt_ip" key on list element index 1 yields "10.1.20.1".

Step-by-Step Solution

1
Analyze the top-level structure of the JSON payload.
The root is a dictionary/object containing the top-level key "response". Accessing `data["response"]` yields an inner dictionary.
Top-level keys must be referenced first.
2
Locate the nested key containing the list of devices.
Inside `data["response"]`, the key "devices" holds a JSON array (Python list) of device dictionary objects.
The array is stored under the "devices" key within the response object.
3
Determine the zero-based list index for the ACCESS device object.
The DISTRIBUTION device is at index 0, and the ACCESS device is at index 1.
JSON arrays correspond to Python zero-indexed lists.
4
Extract the target key value from the selected device dictionary.
Accessing `["mgmt_ip"]` on index 1 yields "10.1.20.1".
The dictionary key storing the IP address is "mgmt_ip".

Key Concept

Traversing nested JSON structures and combining dictionary key references with zero-based list array indexing in Python.
Question 17Question

A network administrator executes a RESTCONF GET request to retrieve interface and OSPF routing configuration details from a Cisco router. The response payload is stored in a Python dictionary named `data` as shown below:

{
"ietf-interfaces:interface": {
"name": "GigabitEthernet0/0/1",
"description": "Uplink to Core",
"ietf-ip:ipv4": {
"address": [
{
"ip": "10.10.20.1",
"netmask": "255.255.255.0"
}
]
},
"Cisco-IOS-XE-ospf:ospf": {
"process-id": [
{
"id": 100,
"area": [
{
"area-id": "0.0.0.0",
"cost": 20
}
]
}
]
}
}
}

Match each Python expression on the left to the corresponding value extracted from the JSON structure on the right.

Click a left item, then click its matching right item

Items

data["ietf-interfaces:interface"]["name"]
data["ietf-interfaces:interface"]["ietf-ip:ipv4"]["address"][0]["ip"]
data["ietf-interfaces:interface"]["Cisco-IOS-XE-ospf:ospf"]["process-id"][0]["id"]
data["ietf-interfaces:interface"]["Cisco-IOS-XE-ospf:ospf"]["process-id"][0]["area"][0]["cost"]

Matches

Show answer & explanation

Answer

Matching pairs: data["ietf-interfaces:interface"]["name"] maps to "GigabitEthernet0/0/1"; data["ietf-interfaces:interface"]["ietf-ip:ipv4"]["address"][0]["ip"] maps to "10.10.20.1"; data["ietf-interfaces:interface"]["Cisco-IOS-XE-ospf:ospf"]["process-id"][0]["id"] maps to 100; data["ietf-interfaces:interface"]["Cisco-IOS-XE-ospf:ospf"]["process-id"][0]["area"][0]["cost"] maps to 20.
In Python, JSON objects deserialize into dictionaries accessed via string keys in square brackets, while JSON arrays deserialize into lists accessed using 0-based integer indices. Traversal through keys and list indices accurately extracts specified values.

Step-by-Step Solution

1
Identify JSON data types (objects vs. arrays)
Curly braces {} indicate dictionaries requiring key strings, while square brackets [] indicate lists requiring 0-based integer indexing.
Correctly distinguishing objects from arrays is necessary to apply the proper syntax when parsing Python data structures.
2
Traverse the data path for each expression
Evaluate index positions (0 for the first item in arrays) and dictionary key names sequentially to reach targeted leaf nodes.
Ensures accurate extraction of both string and numeric data values from deeply nested structures.

Key Concept

Interpreting JSON Encoded Data Structures in Python
Question 18Question

A network engineer issues an API call to a Cisco Catalyst Center endpoint to query site health metrics. The API returns the following JSON response payload stored in a Python dictionary named `site_data`:

{
"response": [
{
"siteHierarchy": "Global/USA/SanJose/Building1",
"clientCount": 150,
"healthScore": [
{
"healthType": "OVERALL",
"score": 88
},
{
"healthType": "WIRELESS",
"score": 92
}
]
}
]
}

Which Python expression correctly extracts the numerical score for the WIRELESS health type from `site_data`?

Show answer & explanation

Answer: site_data["response"][0]["healthScore"][1]["score"]

Answer

site_data["response"][0]["healthScore"][1]["score"]
The expression `site_data["response"][0]["healthScore"][1]["score"]` correctly traverses the data structure step by step: accessing the outer dictionary key "response", selecting the first element (index 0) of the response list, accessing the dictionary key "healthScore", selecting the second element (index 1) of the healthScore list which corresponds to WIRELESS, and finally retrieving the value for the key "score".

Step-by-Step Solution

1
Inspect the root element structure of the JSON payload.
The top-level object is a dictionary with a single key "response", whose value is enclosed in square brackets `[]`, indicating a JSON array (Python list).
Array elements must be accessed using zero-based integer indexing.
2
Navigate into the first element of the "response" list and locate the target array.
`site_data["response"][0]` returns the site dictionary object containing keys like "siteHierarchy", "clientCount", and "healthScore".
Zero-based indexing places the first site dictionary at position [0].
3
Index into the "healthScore" array to access the WIRELESS health object.
The "healthScore" key contains a list of two objects: index [0] is OVERALL and index [1] is WIRELESS.
Accessing `["healthScore"][1]` selects the dictionary `{"healthType": "WIRELESS", "score": 92}`.
4
Extract the target key value from the selected dictionary.
Appending `["score"]` retrieves the integer value 92.
Standard dictionary key access retrieves the value paired with the specified string key.

Key Concept

Data extraction from nested JSON structures containing combinations of objects and arrays
Question 19Question

A network administrator queries a Cisco vManage REST API endpoint to retrieve device interface operational details. The API returns the following JSON payload, which is parsed into a Python dictionary variable named `response_data`:

{
"header": {
"generated_at": 1774137600,
"status": 200
},
"data": [
{
"device_id": "10.10.10.1",
"host_name": "Edge-Router-1",
"interfaces": [
{
"name": "GigabitEthernet1",
"admin_status": "up",
"oper_status": "up",
"ip_address": "192.168.10.1",
"mtu": 1500
},
{
"name": "GigabitEthernet2",
"admin_status": "up",
"oper_status": "down",
"ip_address": "10.0.0.2",
"mtu": 1500
}
]
}
]
}

Which two statements regarding data extraction from this JSON payload are correct? (Select two.)

Select all that apply

Show answer & explanation

Answer: The expression `response_data["data"][0]["host_name"]` evaluates to the string `"Edge-Router-1"`.; The expression `response_data["data"][0]["interfaces"][1]["name"]` evaluates to the string `"GigabitEthernet2"`.

Answer

The two correct statements are: 1) `response_data["data"][0]["host_name"]` evaluates to `"Edge-Router-1"`, and 2) `response_data["data"][0]["interfaces"][1]["name"]` evaluates to `"GigabitEthernet2"`.
The top-level structure is a dictionary containing the key 'data', which holds a list of device objects. Index 0 retrieves the first device object, where key 'host_name' yields 'Edge-Router-1'. Within that device object, key 'interfaces' yields a list of interfaces where index 1 selects the second interface object, yielding the name 'GigabitEthernet2'.

Step-by-Step Solution

1
Examine the outer JSON structure
The root structure is a JSON object (Python dictionary). The top-level key `"data"` maps to a JSON array (Python list) containing a single device dictionary at index 0.
Top-level keys are accessed via dictionary keys, while array values require integer indexing.
2
Evaluate host_name extraction
`response_data["data"][0]["host_name"]` accesses index 0 of `"data"` and retrieves `"Edge-Router-1"`.
Arrays in Python are 0-indexed; therefore index 0 accesses the first element.
3
Evaluate interfaces extraction
`response_data["data"][0]["interfaces"]` is an array of interface objects. Index 0 corresponds to `GigabitEthernet1` and index 1 corresponds to `GigabitEthernet2`.
Index 1 correctly references the second interface element in the list.

Key Concept

JSON Array Indexing and Nested Dictionary Key Lookup
Question 20Question

An network engineer issues a REST API call to a Cisco DNA Center controller to retrieve information regarding managed network devices. The controller returns the following JSON response payload:

{
"response": [
{
"family": "Switches and Hubs",
"hostname": "Dist-Switch-01",
"managementIpAddress": "192.168.10.1",
"upTime": "12 days, 04:12:00",
"interfaceList": [
{
"portName": "GigabitEthernet1/0/1",
"vlan": 10,
"status": "up",
"speed": 1000
},
{
"portName": "GigabitEthernet1/0/2",
"vlan": 20,
"status": "down",
"speed": 1000
}
]
},
{
"family": "Routers",
"hostname": "Edge-Router-01",
"managementIpAddress": "10.1.1.1",
"upTime": "45 days, 11:05:22",
"interfaceList": [
{
"portName": "GigabitEthernet0/0/0",
"vlan": 1,
"status": "up",
"speed": 10000
}
]
}
],
"version": "1.0"
}

Assuming the variable `data` holds the parsed Python dictionary representation of this JSON payload, which Python expression correctly extracts the operating status (`"status"`) of the second interface on the distribution switch (`Dist-Switch-01`)?

Show answer & explanation

Answer: data["response"][0]["interfaceList"][1]["status"]

Answer

data["response"][0]["interfaceList"][1]["status"]
The top-level JSON structure is an object mapped to a Python dictionary containing the key 'response'. The value of 'response' is a list of device objects. The distribution switch ('Dist-Switch-01') is the first element in this list, which corresponds to index 0. Within this dictionary, 'interfaceList' holds a list of interface objects. The second interface ('GigabitEthernet1/0/2') is located at index 1 of this list. Accessing the key 'status' on this dictionary yields the desired value.

Step-by-Step Solution

1
Identify the top-level structure and navigate to the 'response' array
The top-level JSON element is an object (dictionary). Accessing data["response"] returns a list containing two device dictionary objects.
Top-level JSON curly braces {} map to a Python dictionary where keys are string names.
2
Select the distribution switch object from the 'response' array using zero-based indexing
The distribution switch ('Dist-Switch-01') is the first item in the list, accessed via index 0: data["response"][0].
JSON square brackets [] map to Python lists, which use zero-based indexing (0 is the 1st item).
3
Navigate to the 'interfaceList' key within the distribution switch dictionary
Accessing data["response"][0]["interfaceList"] returns a list of interface dictionaries.
The key 'interfaceList' inside the device object points to an array of interface dictionaries.
4
Select the second interface and extract the 'status' key value
The second interface ('GigabitEthernet1/0/2') is at index 1 of the list, and its status is extracted via data["response"][0]["interfaceList"][1]["status"].
The second element in a zero-indexed array has an index of 1.

Key Concept

Interpreting JSON Encoded Data and Accessing Nested Data Structures
Estimated Time:1m 30s
Page 1 / 2Next
Interpreting JSON Encoded Data Practice Questions — Cisco CCNA | Examkin