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?
- "10.1.20.15"Answer
- B"10.1.10.1"
- C["10.1.10.1", "10.1.20.15"]
- D"Switch-Access-01"
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
Key Concept
JSON Data Structure Traversal and Zero-Based Array Indexing