Exam 350-401 | Question id=5587 | Automation |
import json
def get_data():
test_json =""
{
"response":[{
"managementlpAddress": "10.10.2.253",
"memorySize": "3398101469",
"serialNumber": "FXS1932Q2SE",
"softwareVersion": "16.3.2",
"hostname": "cat_9k"
}],
"version": "1.0"
}
""
Which line must be added in the Python function to return the JSON object {'cat_9k': 'FXS1932Q2SE'}?
A. |
return (json.dumps({d['hostname']: d['serialNumber'] for d in json.loads(test_json)['response']})) | |
B. |
return (json.dumps({for d in json.loads(test_json)['response']: d['hostname']: d['serialNumber']})) | |
C. |
return (json.loads({d['hostname']: d['serialNumber'] for d in json.dumps(test_json)['response'})) | |
D. |
return (json.loads({for d in json.dumps(test_json)['response']: d['hostname']: d['serialNumber']})) |