Mar-19-2023, 12:54 PM
Hello my friends,
Wish you al have a restful sunday.
I want to use one json file in python with a following code.
Thank you.
Wish you al have a restful sunday.
I want to use one json file in python with a following code.
import json import datetime import pandas as pd list=[] with open("12.json", encoding="UTF-8") as f: jsondata = json.load(f) for matches in jsondata["items"]: if "Alternative" in matches["champName"]: continue list.append([matches["champName"],datetime.datetime.fromtimestamp(matches["dateStart"]),matches["opp1"],matches["opp2"],matches["score"]]) df=pd.DataFrame(list) df.to_excel("output.xlsx") print("Saved.")when I run it, it gives such error.
Error:Traceback (most recent call last):
File "c:\Users\monst\Downloads\python_stavka\parcali_results\parcali_results-FilterExcel-dateupdate.py", line 8, in <module>
jsondata = json.load(f)
File "C:\Users\monst\AppData\Local\Programs\Python\Python310\lib\json\__init__.py", line 293, in load
return loads(fp.read(),
File "C:\Users\monst\AppData\Local\Programs\Python\Python310\lib\json\__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "C:\Users\monst\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\monst\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 15 column 1 (char 1472190)
How can I fix that?Thank you.