nerdexam
Cisco

300-435 · Question #115

Refer to the exhibit. Cisco SD-WAN deployment must be fixed using vManage APIs. A call to vEdge Hardware Health API returns the data in the exhibit (only a portion is shown). If the JSON shown in…

The correct answer is C. d['data'][0]['statusList'][0]['status']. To access the "status" property nested within the first element of the statusList array, which itself is inside the first element of the data array of a Python dictionary d, the correct reference is d['data'][0]['statusList'][0]['status'].

Controller-Based Network Automation

Question

Refer to the exhibit. Cisco SD-WAN deployment must be fixed using vManage APIs. A call to vEdge Hardware Health API returns the data in the exhibit (only a portion is shown). If the JSON shown in the exhibit is converted to a Python dictionary named "d", how is the "status" property referenced?
{
 "data": [
 {
 "count": 4,
 "detailsURL": "",
 "name": "vEdge Hardware Health",
 "status": "error",
 "statusList": [
 {
 "count": 4,
 "detailsURL": "/dataservice/device/hardwarehealth/detail?state=normal',
 "message": "4 (normal=4, warning=0, error=0)",
 "name": "normal",
 "status": "up"
 }
 ]
 }
 ]
}

Options

  • Ad['data'][0]['statusList']["status"]
  • Bnbvnbvvnbhg
  • Cd['data'][0]['statusList'][0]['status']
  • Dd['data'][0]['statusList'][0]['status']

How the community answered

(38 responses)
  • A
    3% (1)
  • B
    5% (2)
  • C
    89% (34)
  • D
    3% (1)

Why each option

To access the "status" property nested within the first element of the `statusList` array, which itself is inside the first element of the `data` array of a Python dictionary `d`, the correct reference is `d['data'][0]['statusList'][0]['status']`.

Ad['data'][0]['statusList']["status"]

This attempt incorrectly tries to access 'status' directly from the 'statusList' list itself, rather than from an element *within* the list, which would result in a TypeError because a list cannot be indexed by a string key like 'status'.

Bnbvnbvvnbhg

"nbvnbvvnbhg" is clearly a random string and not a valid Python dictionary reference.

Cd['data'][0]['statusList'][0]['status']Correct

The JSON structure shows "data" as a list, so `d['data'][0]` accesses its first element. Within that element, "statusList" is another list, so `d['data'][0]['statusList'][0]` accesses its first element. Finally, `['status']` accesses the "status" key within that nested dictionary, which holds the value "up".

Dd['data'][0]['statusList'][0]['status']

This choice is syntactically identical to option C and would also be correct, but typically only one choice is the intended answer in a multiple-choice question format.

Concept tested: Python dictionary and list indexing for JSON parsing

Topics

#JSON Parsing#Python Dictionary#API Data Structures#vManage API

Community Discussion

No community discussion yet for this question.

Full 300-435 Practice