0
I have over 100,000 JSON's that I need in a Pandas DB/CSV for further processing. I tried the following code (after going through 100's of articles) and got the error below:
>>> jsondata = json.loads(open("/Users/tom/Desktop/1.json").read())
>>> type(jsondata)
<class 'str'>
>>> parsed_json = json.loads(jsondata)
Error I get is:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/neel/anaconda3/lib/python3.5/json/__init__.py", line 319, in loads
return _default_decoder.decode(s)
File "/Users/neel/anaconda3/lib/python3.5/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/Users/neel/anaconda3/lib/python3.5/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
I read about the error and it mentions that my starting characters are not JSON compatible. However, when I upload the JSON to JSON validator websites, it validates that it is a correct JSON file.
Another method I tried is using CSV writers, but that converts each character of my JSON into a cell resulting in one column and 50000+ rows. I need to process 100K files a day so any help on this would be appreciated.
My JSON file looks like this:
"TicksVar: [{'timestamp': datetime.datetime(2019, 3, 19, 13, 12, 23), 'last_price': 267.2, 'oi_day_low': 0, 'volume': 627472, 'sell_quantity': 183538, 'last_quantity': 31, 'change': -1.7827605219628828, 'oi': 0, 'average_price': 267.78, 'ohlc': {'high': 273.85, 'close': 272.05, 'open': 272.15, 'low': 265.0}, 'tradable': True, 'depth': {'sell': [{'price': 267.2, 'orders': 3, 'quantity': 7}, {'price': 267.3, 'orders': 3, 'quantity': 105}, {'price': 267.35, 'orders': 2, 'quantity': 235}, {'price': 267.4, 'orders': 2, 'quantity': 1094}, {'price': 267.45, 'orders': 3, 'quantity': 26}], 'buy': [{'price': 267.0, 'orders': 3, 'quantity': 166}, {'price': 266.9, 'orders': 1, 'quantity': 12}, {'price': 266.85, 'orders': 1, 'quantity': 23}, {'price': 266.8, 'orders': 3, 'quantity': 56}, {'price': 266.75, 'orders': 2, 'quantity': 603}]}, 'mode': 'full', 'last_trade_time': datetime.datetime(2019, 3, 19, 13, 12, 22), 'buy_quantity': 169138, 'oi_day_high': 0, 'instrument_token': 2957569}, {'timestamp': datetime.datetime(2019, 3, 19, 13, 12, 23), 'last_price': 348.2, 'oi_day_low': 0, 'volume': 1429275, 'sell_quantity': 280587, 'last_quantity': 13, 'change': 1.3387660069848561, 'oi': 0, 'average_price': 348.08, 'ohlc': {'high': 351.8, 'close': 343.6, 'open': 344.95, 'low': 343.6}, 'tradable': True, 'depth': {'sell': [{'price': 348.35, 'orders': 1, 'quantity': 60}, {'price': 348.4, 'orders': 7, 'quantity': 11}, {'price': 348.45, 'orders': 1, 'quantity': 126}, {'price': 348.5, 'orders': 1, 'quantity': 63}, {'price': 348.55, 'orders': 1, 'quantity': 55}], 'buy': [{'price': 348.1, 'orders': 2, 'quantity': 103}, {'price': 348.05, 'orders': 1, 'quantity': 10}, {'price': 348.0, 'orders': 6, 'quantity': 739}, {'price': 347.95, 'orders': 1, 'quantity': 60}, {'price': 347.9, 'orders': 2, 'quantity': 182}]}, 'mode': 'full', 'last_trade_time': datetime.datetime(2019, 3, 19, 13, 12, 16), 'buy_quantity': 345356, 'oi_day_high': 0, 'instrument_token': 4774913}, {'timestamp': datetime.datetime(2019, 3, 19, 13, 12, 23), 'last_price': 92.95, 'oi_day_low': 0, 'volume': 5815810, 'sell_quantity': 2230022, 'last_quantity': 1, 'change': 1.918859649122807, 'oi': 0, 'average_price': 92.39, 'ohlc': {'high': 93.1, 'close': 91.2, 'open': 91.7, 'low': 91.1}, 'tradable': True, 'depth': {'sell': [{'price': 92.95, 'orders': 30, 'quantity': 8838}, {'price': 93.0, 'orders': 168, 'quantity': 57266}, {'price': 93.05, 'orders': 50, 'quantity': 30194}, {'price': 93.1, 'orders': 109, 'quantity': 48072}, {'price': 93.15, 'orders': 26, 'quantity': 20019}], 'buy': [{'price': 92.9, 'orders': 4, 'quantity': 4733}, {'price': 92.85, 'orders': 12, 'quantity': 37777}, {'price': 92.8, 'orders': 16, 'quantity': 21151}, {'price': 92.75, 'orders': 12, 'quantity': 21051}, {'price': 92.7, 'orders': 13, 'quantity': 17030}]}, 'mode': 'full', 'last_trade_time': datetime.datetime(2019, 3, 19, 13, 12, 22), 'buy_quantity': 1976576, 'oi_day_high': 0, 'instrument_token': 261889}, {'timestamp': datetime.datetime(2019, 3, 19, 13, 12, 23), 'last_price': 326.0, 'oi_day_low': 0, 'volume': 1737707, 'sell_quantity': 271975, 'last_quantity': 1, 'change': 3.0504188398925165, 'oi': 0, 'average_price': 322.84, 'ohlc': {'high': 328.95, 'close': 316.35, 'open': 316.45, 'low': 313.65}, 'tradable': True, 'depth': {'sell': [{'price': 326.05, 'orders': 2, 'quantity': 78}, {'price': 326.1, 'orders': 3, 'quantity': 303}, {'price': 326.15, 'orders': 3, 'quantity': 1931}, {'price': 326.2, 'orders': 7, 'quantity': 1188}, {'price': 326.25, 'orders': 8, 'quantity': 1244}], 'buy': [{'price': 326.0, 'orders': 2, 'quantity': 101}, {'price': 325.95, 'orders': 1, 'quantity': 13}, {'price': 325.9, 'orders': 1, 'quantity': 7}, {'price': 325.85, 'orders': 1, 'quantity': 119}, {'price': 325.8, 'orders': 1, 'quantity': 10}]}, 'mode': 'full', 'last_trade_time': datetime.datetime(2019, 3, 19, 13, 12, 19), 'buy_quantity': 265503, 'oi_day_high': 0, 'instrument_token': 149249}, {'timestamp': datetime.datetime(2019, 3, 19, 13, 12, 23), 'last_price': 1221.55, 'oi_day_low': 0, 'volume': 604904, 'sell_quantity': 107638, 'last_quantity': 10, 'change': -1.3247707904196526, 'oi': 0, 'average_price': 1227.27, 'ohlc': {'high': 1247.9, 'close': 1237.95, 'open': 1240.0, 'low': 1218.4}, 'tradable': True, 'depth': {'sell': [{'price': 1221.0, 'orders': 2, 'quantity': 454}, {'price': 1221.5, 'orders': 1, 'quantity': 2}, {'price': 1221.55, 'orders': 2, 'quantity': 82}, {'price': 1221.6, 'orders': 1, 'quantity': 3}, {'price': 1221.65, 'orders': 1, 'quantity': 39}], 'buy': [{'price': 1220.55, 'orders': 2, 'quantity': 18}, {'price': 1220.5, 'orders': 1, 'quantity': 56}, {'price': 1220.25, 'orders': 1, 'quantity': 2}, {'price': 1220.2, 'orders': 1, 'quantity': 1}, {'price': 1220.1, 'orders': 3, 'quantity': 767}]}, 'mode': 'full', 'last_trade_time': datetime.datetime(2019, 3, 19, 13, 12, 14), 'buy_quantity': 94029, 'oi_day_high': 0, 'instrument_token': 1102337}, {'timestamp': datetime.datetime(2019, 3, 19, 13, 12, 23), 'last_price': 459.0, 'oi_day_low': 0, 'volume': 321101, 'sell_quantity': 113205, 'last_quantity': 151, 'change': 0.02179123992155649, 'oi': 0, 'average_price': 460.73, 'ohlc': {'high': 464.4, 'close': 458.9, 'open': 460.4, 'low': 456.5}, 'tradable': True, 'depth': {'sell': [{'price': 459.05, 'orders': 3, 'quantity': 7}, {'price': 459.1, 'orders': 3, 'quantity': 471}, {'price': 459.15, 'orders': 1, 'quantity': 161}, {'price': 459.2, 'orders': 1, 'quantity': 171}, {'price': 459.25, 'orders': 7, 'quantity': 959}], 'buy': [{'price': 458.55, 'orders': 2, 'quantity': 42}, {'price': 458.5, 'orders': 3, 'quantity': 169}, {'price': 458.45, 'orders': 1, 'quantity': 50}, {'price': 458.35, 'orders': 1, 'quantity': 50}, {'price': 458.25, 'orders': 1, 'quantity': 72}]}, 'mode': 'full', 'last_trade_time': datetime.datetime(2019, 3, 19, 13, 12, 22), 'buy_quantity': 95800, 'oi_day_high': 0, 'instrument_token': 7577089}, {'timestamp': datetime.datetime(2019, 3, 19, 13, 12, 23), 'last_price': 577.05, 'oi_day_low': 0, 'volume': 371690, 'sell_quantity': 69222, 'last_quantity': 10, 'change': -2.442941673710912, 'oi': 0, 'average_price': 580.71, 'ohlc': {'high': 596.7, 'close': 591.5, 'open': 593.8, 'low': 575.35}, 'tradable': True, 'depth': {'sell': [{'price': 577.8, 'orders': 1, 'quantity': 5}, {'price': 577.85, 'orders': 1, 'quantity': 37}, {'price': 577.9, 'orders': 1, 'quantity': 10}, {'price': 577.95, 'orders': 3, 'quantity': 40}, {'price': 578.0, 'orders': 5, 'quantity': 104}], 'buy': [{'price': 577.0, 'orders': 7, 'quantity': 477}, {'price': 576.75, 'orders': 1, 'quantity': 276}, {'price': 576.5, 'orders': 3, 'quantity': 536}, {'price': 576.45, 'orders': 1, 'quantity': 20}, {'price': 576.25, 'orders': 1, 'quantity': 277}]}, 'mode': 'full', 'last_trade_time': datetime.datetime(2019, 3, 19, 13, 12, 21), 'buy_quantity': 85204, 'oi_day_high': 0, 'instrument_token': 5436929}, {'timestamp': datetime.datetime(2019, 3, 19, 13, 12, 23), 'last_price': 130.35, 'oi_day_low': 0, 'volume': 2417289, 'sell_quantity': 1068969, 'last_quantity': 20, 'change': 1.2034161490683097, 'oi': 0, 'average_price': 130.53, 'ohlc': {'high': 132.5, 'close': 128.8, 'open': 129.5, 'low': 128.15}, 'tradable': True, 'depth': {'sell': [{'price': 130.45, 'orders': 3, 'quantity': 1444}, {'price': 130.5, 'orders': 12, 'quantity': 15436}, {'price': 130.55, 'orders': 18, 'quantity': 22738}, {'price': 130.6, 'orders': 10, 'quantity': 5431}, {'price': 130.65, 'orders': 8, 'quantity': 5141}], 'buy': [{'price': 130.35, 'orders': 3, 'quantity': 430}, {'price': 130.3, 'orders': 3, 'quantity': 1182}, {'price': 130.25, 'orders': 9, 'quantity': 3457}, {'price': 130.2, 'orders': 17, 'quantity': 9392}, {'price': 130.15, 'orders': 10, 'quantity': 7741}]}, 'mode': 'full', 'last_trade_time': datetime.datetime(2019, 3, 19, 13, 12, 5), 'buy_quantity': 828582, 'oi_day_high': 0, 'instrument_token': 2061825}, {'timestamp': datetime.datetime(2019, 3, 19, 13, 12, 23), 'last_price': 89.0, 'oi_day_low': 0, 'volume': 15253457, 'sell_quantity': 1291082, 'last_quantity': 200, 'change': 6.268656716417911, 'oi': 0, 'average_price': 86.73, 'ohlc': {'high': 89.15, 'close': 83.75, 'open': 84.5, 'low': 84.1}, 'tradable': True, 'depth': {'sell': [{'price': 89.05, 'orders': 3, 'quantity': 1350}, {'price': 89.1, 'orders': 30, 'quantity': 13815}, {'price': 89.15, 'orders': 44, 'quantity': 80714}, {'price': 89.2, 'orders': 70, 'quantity': 40560}, {'price': 89.25, 'orders': 52, 'quantity': 44139}], 'buy': [{'price': 89.0, 'orders': 1, 'quantity': 296}, {'price': 88.95, 'orders': 17, 'quantity': 16201}, {'price': 88.9, 'orders': 41, 'quantity': 42311}, {'price': 88.85, 'orders': 30, 'quantity': 60583}, {'price': 88.8, 'orders': 29, 'quantity': 22129}]}, 'mode': 'full', 'last_trade_time': datetime.datetime(2019, 3, 19, 13, 12, 23), 'buy_quantity': 2532156, 'oi_day_high': 0, 'instrument_token': 2752769}, {'timestamp': datetime.datetime(2019, 3, 19, 13, 12, 22), 'last_price': 249.3, 'oi_day_low': 0, 'volume': 14066450, 'sell_quantity': 2718056, 'last_quantity': 6, 'change': 1.3620654604594522, 'oi': 0, 'average_price': 248.14, 'ohlc': {'high': 250.5, 'close': 245.95, 'open': 246.65, 'low': 245.0}, 'tradable': True, 'depth': {'sell': [{'price': 249.3, 'orders': 2, 'quantity': 317}, {'price': 249.35, 'orders': 10, 'quantity': 18421}, {'price': 249.4, 'orders': 27, 'quantity': 5958}, {'price': 249.45, 'orders': 12, 'quantity': 7487}, {'price': 249.5, 'orders': 68, 'quantity': 25282}], 'buy': [{'price': 249.25, 'orders': 4, 'quantity': 405}, {'price': 249.2, 'orders': 12, 'quantity': 10091}, {'price': 249.15, 'orders': 27, 'quantity': 12850}, {'price': 249.1, 'orders': 28, 'quantity': 9070}, {'price': 249.05, 'orders': 33, 'quantity': 12931}]}, 'mode': 'full', 'last_trade_time': datetime.datetime(2019, 3, 19, 13, 12, 21), 'buy_quantity': 8907070, 'oi_day_high': 0, 'instrument_token': 3050241}, {'timestamp': datetime.datetime(2019, 3, 19, 13, 12, 23), 'last_price': 14.25, 'oi_day_low': 0, 'volume': 569191, 'sell_quantity': 594043, 'last_quantity': 10, 'change': 1.7857142857142858, 'oi': 0, 'average_price': 14.05, 'ohlc': {'high': 14.25, 'close': 14.0, 'open': 14.1, 'low': 13.85}, 'tradable': True, 'depth': {'sell': [{'price': 14.25, 'orders': 32, 'quantity': 12133}, {'price': 14.3, 'orders': 22, 'quantity': 10482}, {'price': 14.35, 'orders': 10, 'quantity': 8290}, {'price': 14.4, 'orders': 9, 'quantity': 6013}, {'price': 14.45, 'orders': 7, 'quantity': 693}], 'buy': [{'price': 14.2, 'orders': 5, 'quantity': 12772}, {'price': 14.15, 'orders': 9, 'quantity': 16837}, {'price': 14.1, 'orders': 17, 'quantity': 70000}, {'price': 14.05, 'orders': 16, 'quantity': 21782}, {'price': 14.0, 'orders': 40, 'quantity': 39133}]}, 'mode': 'full', 'last_trade_time': datetime.datetime(2019, 3, 19, 13, 12, 15), 'buy_quantity': 652620, 'oi_day_high': 0, 'instrument_token': 2393089}, {'timestamp': datetime.datetime(2019, 3, 19, 13, 12, 23), 'last_price': 602.05, 'oi_day_low': 0, 'volume': 563398, 'sell_quantity': 192197, 'last_quantity': 30, 'change': 1.0659728051032245, 'oi': 0, 'average_price': 599.28, 'ohlc': {'high': 603.15, 'close': 595.7, 'open': 599.4, 'low': 594.05}, 'tradable': True, 'depth': {'sell': [{'price': 602.1, 'orders': 1, 'quantity': 101}, {'price': 602.15, 'orders': 2, 'quantity': 491}, {'price': 602.2, 'orders': 1, 'quantity': 6}, {'price': 602.25, 'orders': 1, 'quantity': 123}, {'price': 602.35, 'orders': 2, 'quantity': 325}], 'buy': [{'price': 602.05, 'orders': 4, 'quantity': 92}, {'price': 602.0, 'orders': 3, 'quantity': 135}, {'price': 601.85, 'orders': 2, 'quantity': 128}, {'price': 601.8, 'orders': 1, 'quantity': 123}, {'price': 601.75, 'orders': 2, 'quantity': 317}]}, 'mode': 'full', 'last_trade_time': datetime.datetime(2019, 3, 19, 13, 12, 22), 'buy_quantity': 219147, 'oi_day_high': 0, 'instrument_token': 6054401}, {'timestamp': datetime.datetime(2019, 3, 19, 13, 12, 22), 'last_price': 189.45, 'oi_day_low': 0, 'volume': 10841881, 'sell_quantity': 759062, 'last_quantity': 100, 'change': 4.900332225913618, 'oi': 0, 'average_price': 188.41, 'ohlc': {'high': 191.4, 'close': 180.6, 'open': 187.6, 'low': 186.0}, 'tradable': True, 'depth': {'sell': [{'price': 189.5, 'orders': 4, 'quantity': 3212}, {'price': 189.55, 'orders': 4, 'quantity': 604}, {'price': 189.6, 'orders': 2, 'quantity': 742}, {'price': 189.65, 'orders': 2, 'quantity': 310}, {'price': 189.7, 'orders': 7, 'quantity': 718}], 'buy': [{'price': 189.45, 'orders': 1, 'quantity': 153}, {'price': 189.4, 'orders': 2, 'quantity': 502}, {'price': 189.35, 'orders': 8, 'quantity': 1878}, {'price': 189.3, 'orders': 21, 'quantity': 3477}, {'price': 189.25, 'orders': 6, 'quantity': 2305}]}, 'mode': 'full', 'last_trade_time': datetime.datetime(2019, 3, 19, 13, 12, 22), 'buy_quantity': 1276356, 'oi_day_high': 0, 'instrument_token': 737793}, {'timestamp': datetime.datetime(2019, 3, 19, 13, 12, 23), 'last_price': 27.41, 'oi_day_low': 0, 'volume': 5456156, 'sell_quantity': 1767869, 'last_quantity': 4000, 'change': 2.314296379245991, 'oi': 0, 'average_price': 27.18, 'ohlc': {'high': 27.43, 'close': 26.79, 'open': 26.85, 'low': 26.65}, 'tradable': True, 'depth': {'sell': [{'price': 27.42, 'orders': 6, 'quantity': 7955}, {'price': 27.43, 'orders': 6, 'quantity': 4572}, {'price': 27.44, 'orders': 14, 'quantity': 7402}, {'price': 27.45, 'orders': 57, 'quantity': 46076}, {'price': 27.46, 'orders': 4, 'quantity': 1029}], 'buy': [{'price': 27.41, 'orders': 1, 'quantity': 5900}, {'price': 27.38, 'orders': 2, 'quantity': 4090}, {'price': 27.37, 'orders': 2, 'quantity': 12045}, {'price': 27.36, 'orders': 4, 'quantity': 436566}, {'price': 27.35, 'orders': 1, 'quantity': 400000}]}, 'mode': 'full', 'last_trade_time': datetime.datetime(2019, 3, 19, 13, 12, 16), 'buy_quantity': 1211327, 'oi_day_high': 0, 'instrument_token': 595969}, {'timestamp': datetime.datetime(2019, 3, 19, 13, 12, 23), 'last_price': 2936.3, 'oi_day_low': 0, 'volume': 964490, 'sell_quantity': 151829, 'last_quantity': 1, 'change': 0.2304108139475346, 'oi': 0, 'average_price': 2945.44, 'ohlc': {'high': 2962.9, 'close': 2929.55, 'open': 2930.0, 'low': 2925.15}, 'tradable': True, 'depth': {'sell': [{'price': 2937.3, 'orders': 1, 'quantity': 2}, {'price': 2937.35, 'orders': 1, 'quantity': 8}, {'price': 2937.9, 'orders': 1, 'quantity': 2}, {'price': 2937.95, 'orders': 1, 'quantity': 67}, {'price': 2938.0, 'orders': 1, 'quantity': 52}], 'buy': [{'price': 2936.2, 'orders': 2, 'quantity': 20}, {'price': 2936.15, 'orders': 1, 'quantity': 28}, {'price': 2935.8, 'orders': 1, 'quantity': 2}, {'price': 2935.75, 'orders': 1, 'quantity': 1}, {'price': 2935.7, 'orders': 1, 'quantity': 7}]}, 'mode': 'full', 'last_trade_time': datetime.datetime(2019, 3, 19, 13, 12, 23), 'buy_quantity': 107793, 'oi_day_high': 0, 'instrument_token': 81153}, {'timestamp': datetime.datetime(2019, 3, 19, 13, 12, 23), 'last_price': 102.35, 'oi_day_low': 0, 'volume': 16953667, 'sell_quantity': 1107783, 'last_quantity': 150, 'change': 7.680168332456599, 'oi': 0, 'average_price': 99.27, 'ohlc': {'high': 102.75, 'close': 95.05, 'open': 95.95, 'low': 95.3}, 'tradable': True, 'depth': {'sell': [{'price': 102.4, 'orders': 2, 'quantity': 123}, {'price': 102.45, 'orders': 12, 'quantity': 7454}, {'price': 102.5, 'orders': 46, 'quantity': 39071}, {'price': 102.55, 'orders': 21, 'quantity': 28518}, {'price': 102.6, 'orders': 44, 'quantity': 29818}], 'buy': [{'price': 102.35, 'orders': 6, 'quantity': 3675}, {'price': 102.3, 'orders': 16, 'quantity': 15145}, {'price': 102.25, 'orders': 24, 'quantity': 37224}, {'price': 102.2, 'orders': 37, 'quantity': 45716}, {'price': 102.15, 'orders': 17, 'quantity': 25832}]}, 'mode': 'full', 'last_trade_time': datetime.datetime(2019, 3, 19, 13, 12, 22), 'buy_quantity': 2542799, 'oi_day_high': 0, 'instrument_token': 1214721}, {'timestamp': datetime.datetime(2019, 3, 19, 13, 12, 23), 'last_price': 52.85, 'oi_day_low': 0, 'volume': 12990186, 'sell_quantity': 3426374, 'last_quantity': 18, 'change': 1.1483253588516773, 'oi': 0, 'average_price': 52.6, 'ohlc': {'high': 53.15, 'close': 52.25, 'open': 52.5, 'low': 52.05}, 'tradable': True, 'depth': {'sell': [{'price': 52.85, 'orders': 6, 'quantity': 26470}, {'price': 52.9, 'orders': 31, 'quantity': 47615}, {'price': 52.95, 'orders': 11, 'quantity': 39147}, {'price': 53.0, 'orders': 26, 'quantity': 60792}, {'price': 53.05, 'orders': 17, 'quantity': 45192}], 'buy': [{'price': 52.8, 'orders': 9, 'quantity': 7289}, {'price': 52.75, 'orders': 50, 'quantity': 55352}, {'price': 52.7, 'orders': 29, 'quantity': 151604}, {'price': 52.65, 'orders': 28, 'quantity': 50052}, {'price': 52.6, 'orders': 53, 'quantity': 61208}]}, 'mode': 'full', 'last_trade_time': datetime.datetime(2019, 3, 19, 13, 12, 22), 'buy_quantity': 4069756, 'oi_day_high': 0, 'instrument_token': 2863105}, {'timestamp': datetime.datetime(2019, 3, 19, 13, 12, 23), 'last_price': 29667.0, 'ohlc': {'high': 29764.5, 'close': 29596.1, 'open': 29702.6, 'low': 29547.7}, 'tradable': False, 'mode': 'full', 'change': 0.23955859048996814, 'instrument_token': 260105}, {'timestamp': datetime.datetime(2019, 3, 19, 13, 12, 23), 'last_price': 418.8, 'oi_day_low': 0, 'volume': 1572447, 'sell_quantity': 811343, 'last_quantity': 129, 'change': -2.502619019904551, 'oi': 0, 'average_price': 421.55, 'ohlc': {'high': 431.6, 'close': 429.55, 'open': 431.6, 'low': 417.35}, 'tradable': True, 'depth': {'sell': [{'price': 418.85, 'orders': 3, 'quantity': 315}, {'price': 418.9, 'orders': 4, 'quantity': 181}, {'price': 418.95, 'orders': 7, 'quantity': 1007}, {'price': 419.0, 'orders': 10, 'quantity': 13209}, {'price': 419.05, 'orders': 2, 'quantity': 280}], 'buy': [{'price': 418.8, 'orders': 1, 'quantity': 71}, {'price': 418.5, 'orders': 2, 'quantity': 568}, {'price': 418.45, 'orders': 1, 'quantity': 120}, {'price': 418.4, 'orders': 3, 'quantity': 178}, {'price': 418.3, 'orders': 3, 'quantity': 271}]}, 'mode': 'full', 'last_trade_time': datetime.datetime(2019, 3, 19, 13, 12, 22), 'buy_quantity': 243624, 'oi_day_high': 0, 'instrument_token': 3400961}, {'timestamp': datetime.datetime(2019, 3, 19, 13, 12, 23), 'last_price': 125.4, 'oi_day_low': 0, 'volume': 21327927, 'sell_quantity': 1424519, 'last_quantity': 25, 'change': 4.023226876814607, 'oi': 0, 'average_price': 122.87, 'ohlc': {'high': 125.85, 'close': 120.55, 'open': 121.2, 'low': 121.05}, 'tradable': True, 'depth': {'sell': [{'price': 125.5, 'orders': 19, 'quantity': 4374}, {'price': 125.55, 'orders': 37, 'quantity': 36504}, {'price': 125.6, 'orders': 41, 'quantity': 40989}, {'price': 125.65, 'orders': 25, 'quantity': 31461}, {'price': 125.7, 'orders': 29, 'quantity': 27256}], 'buy': [{'price': 125.4, 'orders': 9, 'quantity': 2728}, {'price': 125.35, 'orders': 16, 'quantity': 3314}, {'price': 125.3, 'orders': 29, 'quantity': 29020}, {'price': 125.25, 'orders': 20, 'quantity': 32777}, {'price': 125.2, 'orders': 25, 'quantity': 19745}]}, 'mode': 'full', 'last_trade_time': datetime.datetime(2019, 3, 19, 13, 12, 22), 'buy_quantity': 1829767, 'oi_day_high': 0, 'instrument_token': 1195009}, {'timestamp': datetime.datetime(2019, 3, 19, 13, 12, 22), 'last_price': 304.45, 'oi_day_low': 0, 'volume': 16521655, 'sell_quantity': 2424400, 'last_quantity': 20, 'change': 1.839772537213581, 'oi': 0, 'average_price': 303.16, 'ohlc': {'high': 305.5, 'close': 298.95, 'open': 300.15, 'low': 299.15}, 'tradable': True, 'depth': {'sell': [{'price': 304.5, 'orders': 2, 'quantity': 1081}, {'price': 304.55, 'orders': 3, 'quantity': 228}, {'price': 304.6, 'orders': 8, 'quantity': 4109}, {'price': 304.65, 'orders': 12, 'quantity': 6979}, {'price': 304.7, 'orders': 23, 'quantity': 11182}], 'buy': [{'price': 304.45, 'orders': 5, 'quantity': 1393}, {'price': 304.4, 'orders': 13, 'quantity': 2508}, {'price': 304.35, 'orders': 18, 'quantity': 5325}, {'price': 304.3, 'orders': 38, 'quantity': 12922}, {'price': 304.25, 'orders': 32, 'quantity': 33877}]}, 'mode': 'full', 'last_trade_time': datetime.datetime(2019, 3, 19, 13, 12, 22), 'buy_quantity': 1685715, 'oi_day_high': 0, 'instrument_token': 779521}, {'timestamp': datetime.datetime(2019, 3, 19, 13, 12, 23), 'last_price': 1963.45, 'oi_day_low': 0, 'volume': 1698344, 'sell_quantity': 847608, 'last_quantity': 1, 'change': 0.053505911129227195, 'oi': 0, 'average_price': 1969.47, 'ohlc': {'high': 1978.55, 'close': 1962.4, 'open': 1972.9, 'low': 1962.1}, 'tradable': True, 'depth': {'sell': [{'price': 1964.0, 'orders': 2, 'quantity': 4}, {'price': 1964.35, 'orders': 3, 'quantity': 3}, {'price': 1964.4, 'orders': 1, 'quantity': 82}, {'price': 1964.45, 'orders': 2, 'quantity': 105}, {'price': 1964.5, 'orders': 1, 'quantity': 1}], 'buy': [{'price': 1963.45, 'orders': 4, 'quantity': 345}, {'price': 1963.3, 'orders': 1, 'quantity': 25}, {'price': 1963.25, 'orders': 1, 'quantity': 5}, {'price': 1963.2, 'orders': 3, 'quantity': 115}, {'price': 1963.15, 'orders': 1, 'quantity': 500}]}, 'mode': 'full', 'last_trade_time': datetime.datetime(2019, 3, 19, 13, 12, 22), 'buy_quantity': 166752, 'oi_day_high': 0, 'instrument_token': 340481}, {'timestamp': datetime.datetime(2019, 3, 19, 13, 12, 23), 'last_price': 44.8, 'oi_day_low': 0, 'volume': 3556172, 'sell_quantity': 1606262, 'last_quantity': 17, 'change': 2.8702640642939152, 'oi': 0, 'average_price': 44.57, 'ohlc': {'high': 45.35, 'close': 43.55, 'open': 44.05, 'low': 43.65}, 'tradable': True, 'depth': {'sell': [{'price': 44.9, 'orders': 17, 'quantity': 16068}, {'price': 44.95, 'orders': 24, 'quantity': 40254}, {'price': 45.0, 'orders': 41, 'quantity': 42482}, {'price': 45.05, 'orders': 11, 'quantity': 24834}, {'price': 45.1, 'orders': 17, 'quantity': 27788}], 'buy': [{'price': 44.8, 'orders': 7, 'quantity': 10866}, {'price': 44.75, 'orders': 27, 'quantity': 36914}, {'price': 44.7, 'orders': 22, 'quantity': 34541}, {'price': 44.65, 'orders': 19, 'quantity': 47422}, {'price': 44.6, 'orders': 24, 'quantity': 19049}]}, 'mode': 'full', 'last_trade_time': datetime.datetime(2019, 3, 19, 13, 12, 22), 'buy_quantity': 2004037, 'oi_day_high': 0, 'instrument_token': 3060993}, {'timestamp': datetime.datetime(2019, 3, 19, 13, 12, 23), 'last_price': 493.75, 'oi_day_low': 0, 'volume': 338786, 'sell_quantity': 151345, 'last_quantity': 1, 'change': 0.2741673436230753, 'oi': 0, 'average_price': 493.3, 'ohlc': {'high': 499.0, 'close': 492.4, 'open': 493.0, 'low': 487.45}, 'tradable': True, 'depth': {'sell': [{'price': 493.9, 'orders': 2, 'quantity': 49}, {'price': 493.95, 'orders': 2, 'quantity': 145}, {'price': 494.0, 'orders': 9, 'quantity': 611}, {'price': 494.05, 'orders': 1, 'quantity': 304}, {'price': 494.15, 'orders': 1, 'quantity': 1}], 'buy': [{'price': 493.75, 'orders': 2, 'quantity': 95}, {'price': 493.45, 'orders': 1, 'quantity': 35}, {'price': 493.05, 'orders': 1, 'quantity': 24}, {'price': 493.0, 'orders': 4, 'quantity': 33}, {'price': 492.9, 'orders': 1, 'quantity': 1}]}, 'mode': 'full', 'last_trade_time': datetime.datetime(2019, 3, 19, 13, 12, 23), 'buy_quantity': 115457, 'oi_day_high': 0, 'instrument_token': 579329}, {'timestamp': datetime.datetime(2019, 3, 19, 13, 12, 23), 'last_price': 280.25, 'oi_day_low': 0, 'volume': 5544017, 'sell_quantity': 482928, 'last_quantity': 2, 'change': 2.957384276267455, 'oi': 0, 'average_price': 276.88, 'ohlc': {'high': 280.8, 'close': 272.2, 'open': 273.1, 'low': 271.75}, 'tradable': True, 'depth': {'sell': [{'price': 280.3, 'orders': 1, 'quantity': 150}, {'price': 280.35, 'orders': 2, 'quantity': 505}, {'price': 280.4, 'orders': 5, 'quantity': 4070}, {'price': 280.45, 'orders': 6, 'quantity': 2275}, {'price': 280.5, 'orders': 18, 'quantity': 6188}], 'buy': [{'price': 280.25, 'orders': 1, 'quantity': 652}, {'price': 280.2, 'orders': 2, 'quantity': 151}, {'price': 280.15, 'orders': 5, 'quantity': 1427}, {'price': 280.1, 'orders': 8, 'quantity': 1014}, {'price': 280.05, 'orders': 10, 'quantity': 4050}]}, 'mode': 'full', 'last_trade_time': datetime.datetime(2019, 3, 19, 13, 12, 22), 'buy_quantity': 783598, 'oi_day_high': 0, 'instrument_token': 2763265}]"
1Your JSON is not valid. The root has to be a “value”: An array, an object, a string, ... In your case, provided the quotes are not actually in the file, it’s a key. And even then, the datetime stuff is also completely unacceptable. – Daniel B – 2019-04-18T11:29:57.703
Is there a way to make this JSON work by reformatting as this is the format I am getting from 3rd Party Websites and I have little control in its structure ? – Neel – 2019-04-18T11:32:31.463