A controller API returns this data:
{
"device": {
"hostname": "Dist-1",
"interfaces": [
{"name": "Gig0/0", "status": "up"},
{"name": "Gig0/1", "status": "down"}
]
}
}Which statement is correct?
{
"device": {
"hostname": "Dist-1",
"interfaces": [
{"name": "Gig0/0", "status": "up"},
{"name": "Gig0/1", "status": "down"}
]
}
}A controller API returns this data:
{
"device": {
"hostname": "Dist-1",
"interfaces": [
{"name": "Gig0/0", "status": "up"},
{"name": "Gig0/1", "status": "down"}
]
}
}Which statement is correct?
Answer choices
Good practice is not just finding the correct option. The wrong answers often show the exact trap the exam wants you to fall into.
The response is XML because it contains nested elements
XML uses opening and closing tags such as <device> and <hostname>. The exhibit does not use tags at all. Instead it uses braces, brackets, quoted keys, and values, which are the visual clues for JSON rather than XML.
The interfaces field is an array of objects
Correct. This is correct. The interfaces field is enclosed in square brackets, which in JSON means an array. Each item inside the array is an object containing keys such as name and status.
The hostname field is a list
The hostname field is not a list. It contains one string value, "Dist-1". The only list-like structure shown in the data is the interfaces array.
The format shown is YAML
YAML is another structured data format, but the exact symbols in the exhibit are JSON symbols. YAML would typically look different and would not rely on the same object-and-array punctuation in this form.
Common exam trap
A frequent exam trap is mistaking the JSON response for XML or YAML because all three formats represent hierarchical data. The presence of nested elements might mislead candidates to select XML, but XML requires explicit opening and closing tags, which are absent here. Similarly, YAML uses indentation rather than braces and brackets. Confusing these formats can cause errors in interpreting API data structures, leading to incorrect automation scripts or misreading controller outputs. The key is to identify JSON’s distinctive use of braces for objects and square brackets for arrays.
Technical deep dive
JSON (JavaScript Object Notation) is a lightweight data-interchange format widely used in network automation and programmability, including Cisco controller APIs. It represents data as key-value pairs within objects (curly braces) and ordered lists within arrays (square brackets). This structure allows network devices and controllers to exchange configuration and status information in a standardized, machine-readable format. Understanding JSON is essential for interpreting API responses in automation workflows. In the provided example, the "interfaces" field is enclosed in square brackets, indicating an array. Each element inside this array is an object containing keys such as "name" and "status". This means the API returns a list of interface objects, each describing a specific interface's state. Recognizing arrays versus objects in JSON helps network engineers parse and manipulate data correctly when automating tasks like interface monitoring or configuration. A common exam trap is confusing JSON with XML or YAML formats due to their similar hierarchical data representation. JSON uses braces and brackets without tags, unlike XML's angle-bracket tags or YAML's indentation-based syntax. Misidentifying the data format can lead to incorrect assumptions about data structure and parsing methods. Practically, Cisco automation tools and APIs predominantly use JSON, so mastering its syntax and semantics is critical for effective network programmability.
Related practice questions
Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.
Practise IPv4 subnetting, CIDR, masks, host ranges and subnet selection.
Practise OSPF neighbours, router IDs, metrics, areas and routing-table interpretation.
Practise VLANs, access ports, trunks, allowed VLANs and switching scenarios.
Practise spanning tree, root bridge election, port roles and STP troubleshooting.
Practise LACP, PAgP, port-channel behaviour and bundle requirements.
Practise standard and extended ACLs, permit/deny logic and traffic filtering.
Practise static NAT, dynamic NAT, PAT and inside/outside address translation.
Practise DHCP scopes, relay, leases and troubleshooting.
Practise routing-table output, longest-prefix match, AD and route selection.
Practise trunk verification and VLAN forwarding across switches.
Practise WLAN security, authentication and wireless architecture concepts.
Practise IPv6 addressing, routes, neighbour discovery and common IPv6 exam traps.
Keep practising from the same exam bank, or move into a focused topic page if this question exposed a weak area.
Question 1
Question 2
Question 3
Question 4
Question 5
Question 6
FAQ
JSON uses curly braces to define objects and square brackets to define arrays, which represent lists of items in network data.
The correct answer is: The interfaces field is an array of objects — The interfaces field is an array of objects. The giveaway is the square brackets around the interface entries. In JSON, square brackets represent an array, and braces represent an object. Each interface entry inside that array has key-value pairs such as name and status, which makes each entry its own object. In plain language, the controller is returning a list of interface records for one device. The hostname field, by contrast, is a single value. This style of question appears in automation topics because the exam wants you to recognize common data structures used in controller APIs without requiring deep programming expertise. Understanding the difference between an object and an array is usually enough.
Then try more questions from the same exam bank and focus on understanding why the wrong options are tempting.
Sign in to join the discussion.