350-401 · Question #356
350-401 Question #356: Real Exam Question with Answer & Explanation
The correct answer is D: json_data = response.json() print(json_data['response'][0]['upTime']). Answer D is correct because when parsing a JSON API response using the requests library, response.json() is the proper method to deserialize the JSON payload into a Python dictionary. The 'response' key contains a list (array), so index [0] is used to access the first element, an
Question
Based on the output below, which Python code shows the value of the "upTime" key? A. B. C. D.
Options
- Ajson_data = response.json() print(json_data['response'][family]['upTime'])
- Bjson_data = response.json() print(json_data['response'][0]['upTime'])
- Cjson_data = json.loads(response.text) print(json_data['response'][family]['upTime'])
- Djson_data = response.json() print(json_data['response'][0]['upTime'])
Explanation
Answer D is correct because when parsing a JSON API response using the requests library, response.json() is the proper method to deserialize the JSON payload into a Python dictionary. The 'response' key contains a list (array), so index [0] is used to access the first element, and then 'upTime' retrieves the specific key value - this is the standard pattern for navigating nested JSON structures from REST API responses.
Topics
Community Discussion
No community discussion yet for this question.