Python Forum
JSON - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: JSON (/thread-19741.html)



JSON - fakka - Jul-12-2019

JSON looks like this

===========================
{
"op": {
"samples": {
"COL_1_RESULT": [
2533973817,
3745333807,
3745333807,
3745333807,
3745341999,
3745341999,
3745350191,
3745493551,
3745505839,
3745514031
],
"COL_2_RESULT": [
23,
22,
22,
22,
22,
22,
22,
22]
},
"samplesCount": 60,
"isPersistent": true,
"lastTStamp": 1562943374678,
"interval": 1000
}
}
===========================

res=requests.get(url, auth=HTTPBasicAuth('*******', '*******'))
json_data = json.loads(res.text)
print(json_data)

print(json_data['COL_2_RESULT'])
This doesnt work ......... I assume its simple - but :)

Worked it out.
Just need to fully qualify the nest. Each layer.