0

I am facing with the following error while reading json from file

    json.decoder.JSONDecodeError: Expecting ',' delimiter: line 2 column 1 (char 948)

The json content is read from file using the script below

import json
if __name__ == "__main__":

     file_path = "D:\\Freelancing\\Scraping_football_historic_data\\Data\\1.138103502"

     with open(file_path,'r') as datafile:

         dict_data = json.load(datafile)

     print(dict_data) 

Upon searching for answer, this question had an answer that suggested me to add r before the json string.

How can it be done in the case above, or if there's a better way to read the file. ?

The contents of the file can be read from the pastebin link: https://pastebin.com/ZyyrtcZW

Lakshmi Narayanan
  • 5,220
  • 13
  • 50
  • 92

1 Answers1

1

You are missing a comma between each of your individual dictionaries, your data should look like

....
{"op":"mcm","clk":"5733948534","pt":1514206953689,"mc":[{"id":"1.138103502","rc":[{"ltp":2.02,"id":48756}]}]},
{"op":"mcm","clk":"5739085003","pt":1514309273736,"mc":[{"id":"1.138103502","rc":[{"ltp":2.0,"id":48756}]}]},
{"op":"mcm","clk":"5739711407","pt":1514327265235,"mc":[{"id":"1.138103502","rc":[{"ltp":2.06,"id":48756}]}]},
.....
Devesh Kumar Singh
  • 20,259
  • 5
  • 21
  • 40