I’m new to python, I used the below code in spyder platform to parse the json file but it reflects an error.
import json with open('D:/Py_Scrach/used_car_prices1.json') as f: data = json.load(f) print(data)
Error:
runfile('C:/Users/sathishkumar.m/.spyder-py3/temp.py', wdir='C:/Users/sathishkumar.m/.spyder-py3') Traceback (most recent call last): File "C:Userssathishkumar.m.spyder-py3temp.py", line 10, in <module> data = json.load(f) File "C:ProgramDataAnaconda3libjson__init__.py", line 293, in load return loads(fp.read(), File "C:ProgramDataAnaconda3libjson__init__.py", line 346, in loads return _default_decoder.decode(s) File "C:ProgramDataAnaconda3libjsondecoder.py", line 340, in decode raise JSONDecodeError("Extra data", s, end) JSONDecodeError: Extra data
Advertisement
Answer
df1 = pd.read_json(“D:/Py_Scrach/used_car_prices1.json”,lines=True)