Home > Software design >  json.decoder.JSONDecodeError: Extra data: line 1 column 139811 (char 139810)
json.decoder.JSONDecodeError: Extra data: line 1 column 139811 (char 139810)

Time:02-20

What I'm trying to do here is to open values.json (which is https://www.rolimons.com/itemapi/itemdetails) but I get error on

values = json.load(file)

    
r = requests.get("https://www.rolimons.com/itemapi/itemdetails")      
with open("values.json", "r ") as f:
  f.write(r.text)
f.close()

file = open("values.json")
values = json.load(file)

CodePudding user response:

This seems to work:

import requests
import json
req = requests.get("https://www.rolimons.com/itemapi/itemdetails")
values = json.loads(req.content)
print(values)
  • Related