I have a following context received from a query in Python script (an example):
{ "active": false, "owner": "user1", "content": [ { "recordType": "test", "record": [ { "id": "1", "date": "Nov 30, 2017 12:00:00 AM", "link": "http://localhost", "Size": 1234, }, { "id": "3", "date": "Nov 21, 2017 06:00:00 AM", "link": "http://localhost", "Size": 3241, } ] } ] }
making this to json array works without errors:
data = json.loads(*string_above*)
as a result this works ok:
print data["owner"]
user1
also this is ok:
print data["content"]
[ { "recordType": "test", "record": [ { "id": "1", "date": "Nov 30, 2017 12:00:00 AM", "link": "http://localhost", "Size": 1234, }, { "id": "3", "date": "Nov 21, 2017 06:00:00 AM", "link": "http://localhost", "Size": 3241, } ]}
Now my problem is how can I make this a multidimensional array?
E.g. command
print data["content"]["record"]
gives an error:
TypeError: list indices must be integers, not str
what I was hoping to get is:
{ "id": "1", "date": "Nov 30, 2017 12:00:00 AM", "link": "http://localhost", "Size": 1234, }, { "id": "3", "date": "Nov 21, 2017 06:00:00 AM", "link": "http://localhost", "Size": 3241, }
Found many different comments on this kind of problem with Google but is there no a simple solution - what am I missing?