Python code examples

JSON PARSING EXAMPLE-1: import json # some JSON: x = '{  "name": "John", "devlist": [ {"name":"kiny", "age":30,"city":"New York"}]}' # parse x: y = json.loads(x) # the result is a Python dictionary: print(y["name"]) print(y["devlist"][0]["name"]) -----------------------RESULT----------------------------- john kiny JSON PARSING EXAMPLE-2: import json # some JSON: loradevice    = \ '[{"devtype":"dlab","deviceeui": ["eui1", "eui2"]}, \   {"devtype":"adenu","deviceeui": ["eui3", "eui4"]}]' # … Continue reading Python code examples