Python解析Json字符串数组对象:

Python解析Json,Python格式化Json,

Python处理Json对象,Python处理Json数组


import json
data= json.loads('{"ID": "2", "IP":"192.168.1.186", "Port": "3000", "Sensor_Count":"1", "Control_Count": "1", "Sensors":{"Sensor_Name": "Json解析", "Type_Count": "1", "Types":{ "types":["temp","C"],"types":["hum","N"],}},"Controls":["LCD","Relay"] }')
print data.ID
输出结果:"2"
data = json.dump(data)
print data
输出结果:{"ID": "2", "IP":"192.168.1.186", "Port": "3000", "Sensor_Count":"1", "Control_Count": "1", "Sensors":{"Sensor_Name": "tem", "Type_Count": "1", "Types":{ "types":["temp","C"],"types":["hum","N"],}},"Controls":["LCD","Relay"] }