Reputation: 1084
Given the json payload below, how do I get the value of 'hotspot' using Python 3.x? The top level seems to be a a dict with one key value pair. 'Recs' is the key and the value is a Python list. I have loaded the json payload into the Python class using json.loads(payload)
.
json payload:
{
'Recs': [{
'eSrc': 'big-a1',
'reqPs': {
'srcIP': '11.111.11.111'
},
'a1': {
'a1Ver': '1.0',
'obj': {
'eTag': '38f028e',
'sz': 1217,
'seq': '02391D2',
'hotspot': 'web/acme/srv/dev/8dd'
},
'confId': 'acme-contains',
'pipe': {
'name': 'acme.dev',
'oId': {
'pId': 'BDAD'
}
}
}
}]
}
Upvotes: 0
Views: 90
Reputation: 49774
{
indicates a dict, [
indicates a list so hotspot
is at:
my_json['Recs'][0]['a1']['obj']['hotspot']
Upvotes: 1