i want to extract Mac_Address from this json in python. anyone can help ?
{"list":
[{
"Group_Devices_id":3,
"User_Id":19,
"Mac_Address":" fe80::f17a:4a64:7192:ed68%2 ",
"Master_Device":"T"
}],
"success":true}
i want to extract Mac_Address from this json in python. anyone can help ?
{"list":
[{
"Group_Devices_id":3,
"User_Id":19,
"Mac_Address":" fe80::f17a:4a64:7192:ed68%2 ",
"Master_Device":"T"
}],
"success":true}
- Import json
- data = json.loads('{"list": [{ "Group_Devices_id":3, "User_Id":19,
"Mac_Address":" fe80::f17a:4a64:7192:ed68%2 ", "Master_Device":"T"
}], "success":true}')
- data['list'][0]['Mac_Address']
Desc : Import json libraray, then load your data. then access any elements.
import json
data = json.loads('{"list": [{ "Group_Devices_id":3, "User_Id":19,
"Mac_Address":" fe80::f17a:4a64:7192:ed68%2 ", "Master_Device":"T"
}], "success":true}'
for item in data["list"]:
print item["Mac_Address"]
1) Load data
2) Assume you need to get Mac_Address from lots of data of list, then use "for...in.." to process