I’m working on a project that uses lots of data, and I’m using a json file to store this data.
this part of code:

with open('user_info.json') as user_file:
    data = json.load(user_file)
    #code from here and on appends info to data
with open('user_info.json', 'w') as user_file:
    json.dump(data, user_file, indent=4)

I am getting this error:

json.decoder.JSONDecodeError: Expecting value: line 8 column 5 (char132)

the error seems to be accruing in line 14 of the code which is where I was doing this:

data = json.load(user_file)

why am I getting this error and how can I fix it?

Hi there.

Given the error, I’d suggest checking that the file you’re reading is valid JSON and doesn’t have an off character somewhere around line 8, col 5?

I can re-create your error by providing malformed JSON (in my case, I removed an opening " from a value), which returns:

json.decoder.JSONDecodeError: Expecting value: line 6 column 21 (char 132)

1 Like

I found my mistake, thanks a lot!

1 Like