Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
json decoding error
#1
Hello my friends,
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.
Reply


Messages In This Thread
json decoding error - by deneme2 - Mar-19-2023, 12:54 PM
RE: json decoding error - by rob101 - Mar-19-2023, 01:16 PM
RE: json decoding error - by deneme2 - Mar-21-2023, 12:38 PM
RE: json decoding error - by Axel_Erfurt - Mar-21-2023, 05:37 PM
RE: json decoding error - by deneme2 - Mar-22-2023, 12:14 PM
RE: json decoding error - by Axel_Erfurt - Mar-22-2023, 04:40 PM
RE: json decoding error - by deneme2 - Mar-22-2023, 05:21 PM
RE: json decoding error - by Axel_Erfurt - Mar-22-2023, 05:36 PM
RE: json decoding error - by deneme2 - Mar-22-2023, 08:09 PM
RE: json decoding error - by deanhystad - Mar-22-2023, 10:44 PM
RE: json decoding error - by Axel_Erfurt - Mar-22-2023, 08:38 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Decoding lat/long in file name johnmcd 4 444 Mar-22-2024, 11:51 AM
Last Post: johnmcd
  json loads throwing error mpsameer 8 804 Jan-23-2024, 07:04 AM
Last Post: deanhystad
  Enigma Decoding Problem krisarmstrong 4 833 Dec-14-2023, 10:42 AM
Last Post: Larz60+
  python requests library .JSON() error mHosseinDS86 6 3,558 Dec-19-2022, 08:28 PM
Last Post: deanhystad
  Read nested data from JSON - Getting an error marlonbown 5 1,446 Nov-23-2022, 03:51 PM
Last Post: snippsat
  flask app decoding problem mesbah 0 2,400 Aug-01-2021, 08:32 PM
Last Post: mesbah
  Decoding a serial stream AKGentile1963 7 8,834 Mar-20-2021, 08:07 PM
Last Post: deanhystad
  JSON Decode error when using API to create dataframe Rubstiano7 4 3,018 Jan-11-2021, 07:52 PM
Last Post: buran
  Empty response to request causing .json() to error t4keheart 1 10,179 Jun-26-2020, 08:35 PM
Last Post: bowlofred
  empty json file error mcmxl22 1 10,273 Jun-17-2020, 10:20 AM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020