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"] }