Here is my json file. I want to load the data list from it, one by one, and only it. And then, for example plot it...
This is an example, because I am dealing with large data set, with which I could not load all the file (that would create a memory error).
{
"earth": {
"europe": [
{"name": "Paris", "type": "city"},
{"name": "Thames", "type": "river"},
{"par": 2, "data": [1,7,4,7,5,7,7,6]},
{"par": 2, "data": [1,0,4,1,5,1,1,1]},
{"par": 2, "data": [1,0,0,0,5,0,0,0]}
],
"america": [
{"name": "Texas", "type": "state"}
]
}
}
Here is what I tried:
import ijson
filename = "testfile.json"
f = open(filename)
mylist = ijson.items(f, 'earth.europe[2].data.item')
print mylist
It returns me nothing, even when I try to convert it into a list:
[]