import json with open('report.json') as report: data = json.load(report) for i in data[0]['data']: if i['Conception'] == 'Salepoint1' and i['OrderType'] == ['Takeaway']: print(i['DishDiscountSumInt']) Mistake:
File "/Volumes/My Files/Python/iikoBot/gettingReport.py", line 40, in <module> data = json.load(report) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/json/__init__.py", line 268, in load parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/json/__init__.py", line 319, in loads return _default_decoder.decode(s) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/json/decoder.py", line 342, in decode raise JSONDecodeError("Extra data", s, end) json.decoder.JSONDecodeError: Extra data: line 1 column 4752 (char 4751) Structure report.json:
{ "data" : [ { "Conception" : null, "DishDiscountSumInt" : 6420, "DishDiscountSumInt.average" : 6420, "OpenDate.Typed" : "2016-04-22T00:00:00", "OrderType" : "Sale", "UniqOrderId.OrdersCount" : 1 }, ... { "Conception" : "Salepoint1", "DishDiscountSumInt" : 0, "DishDiscountSumInt.average" : 0, "OpenDate.Typed" : "2016-04-22T00:00:00", "OrderType" : "Takeaway", "UniqOrderId.OrdersCount" : 2 } ], "summary" : [ [ { }, { "DishDiscountSumInt" : 153289, "DishDiscountSumInt.average" : 561.5, "UniqOrderId.OrdersCount" : 273 } ], [ { "Conception" : "Salepoint1", "OpenDate.Typed" : "2016-04-22T00:00:00" }, { "DishDiscountSumInt" : 14894, "DishDiscountSumInt.average" : 2978.8000000000002, "UniqOrderId.OrdersCount" : 5 } ], ... ] }