350-401 · Question #1343
Refer to the exhibit. An engineer must pull the interface detail from multiple devices in the network and print out the management IP for the devices based on the JSON responses. VLAN 100 is present o
The correct answer is C. print(json_object["TABLE_intf"]["ROW_intf"][0]["prefix"]). Explanation Option C is correct because json_object is the properly parsed Python dictionary (created via json.loads()), and VLAN 100 - being the first interface entry in the JSON response - is located at index [0] of the ROW_intf list, making json_object["TABLE_intf"]["ROW_intf"
Question
Refer to the exhibit. An engineer must pull the interface detail from multiple devices in the network and print out the management IP for the devices based on the JSON responses. VLAN 100 is present on all switches and is used for management. Which line of code must be applied?
Exhibits
Options
- Aprint(json.dumps["TABLE_intf"]["ROW_intf"][2]["prefix"])
- Bprint(json_object["TABLE_intf"]["ROW_intf"][1]["prefix"])
- Cprint(json_object["TABLE_intf"]["ROW_intf"][0]["prefix"])
- Dprint(json.dumps["TABLE_intf"]["ROW_intf"]["prefix"])
How the community answered
(41 responses)- A7% (3)
- B15% (6)
- C76% (31)
- D2% (1)
Explanation
Explanation
Option C is correct because json_object is the properly parsed Python dictionary (created via json.loads()), and VLAN 100 - being the first interface entry in the JSON response - is located at index [0] of the ROW_intf list, making json_object["TABLE_intf"]["ROW_intf"][0]["prefix"] the correct way to retrieve its IP address.
Why the distractors are wrong:
- Option A uses
json.dumpswith square brackets[], which is invalid -json.dumpsis a function called with parentheses(), not a subscriptable dictionary object. - Option B uses index
[1], which would point to the second interface in the list, not VLAN 100 (the first/management interface). - Option D uses
json.dumps(same invalid syntax as A) and also skips the list index entirely, which would cause aTypeErrorsinceROW_intfis a list, not a dictionary.
Memory Tip: Remember "dumps = strings, loads = objects" - json.dumps() converts a Python object to a JSON string, so you can't index into it like a dictionary. Always use your parsed json_object variable, and recall that Python lists are zero-indexed, so the first item is always [0].
Topics
Community Discussion
No community discussion yet for this question.

