I am trying to read the JSON file in python and it is successfully however some top values are skipped. I am trying to debug the reason. Here is the the code.
data = json.load(open('pre.txt'))
for key,val in data['outputs'].items():
print key
print data['outputs'][key]['feat_left']
EDIT
Here is the snapshot the file. I want to read key and feat_left for outputs
{
"outputs": {
"/home/113267806.jpg": {
"feat_left": [
2.369331121444702,
-1.1544183492660522
],
"feat_right": [
2.2432730197906494,
-0.896904468536377
]
},
"/home/115061965.jpg": {
"feat_left": [
1.8996189832687378,
-1.3713303804397583
],
"feat_right": [
1.908974051475525,
-1.4422794580459595
]
},
"/home/119306609.jpg": {
"feat_left": [
-0.7765399217605591,
-1.690917730331421
],
"feat_right": [
-1.1964678764343262,
-1.9359161853790283
]
}
}
}
P.S: Thanks to Rahul K P for the code
/home/113267806.jpgandfeat_left@Supahupe for outputs113267806.jpgis in the output.dictis unordered, so it won't appear in the same position as in the original json, but it is there.