DRAG DROP
-
Drag and drop the code snippets from the bottom onto the blanks in the script to convert a Python object into a compact JSON object by removing space characters. Not all options are used.
DRAG DROP
-
Drag and drop the code snippets from the bottom onto the blanks in the script to convert a Python object into a compact JSON object by removing space characters. Not all options are used.
I guess answer should be "dumps", data. separators If you have a Python object, you can convert it into a JSON string by using the json.dumps() method.
given answer is wrong import json data = { "measurement":"cpmCPUTotal1minRev", "collectionInterval":"default", "tagCount":"0", "policy":None, "devices": [{"model":"cisco 3500 Series WLC","ipv4":"10.10.10.45"}] } obj=json.dumps(data,separators=(',', ':')) print(obj)
I thought CCNP is for Network Engineers not for automation Engineer
Code would indeed (as with the other comments below) look like: import json data = { "measurement": "cpmCPUTotallminRev", "collectionInterval": "default", "tagCount": "0", "policy": None, "devices": [{"model": "Cisco 3500 Series WLC", "ipv4": "10.10.20.52"}] } obj = json.dumps(data, separators=(',', ':')) <======= print(obj)
json.dumps(): used to serialize Python objects into a JSON formatted string json.loads(): used to deserialize a JSON formatted string into a Python object
given answer is incorrect "dumps" - data - separators=(',', ':')
......................
Given answer appears correct.