I am not able to load the following 'data.json' file in python 2.7.11,
file data.json
{
"name":xyz,
"age":12
}
The code i am using the load the above file,
import json
json_data = open ('data.json').read ()
json.loads(json_data)
I always get the following error
ValueError: No JSON object could be decoded
In the meantime,i also tried using yaml.load and it worked fine. But i wanted to know what is that i am doing wrong.
json.load()and pass the file directly. My glass ball suggests: encoding issue."name": xyzisn't valid JSON.xyzisn't a literal. Did you mean"name": "xyz"?