Displaying better error message than “No JSON object could be decoded”

后端 未结 11 1080
既然无缘
既然无缘 2020-11-30 23:05

Python code to load data from some long complicated JSON file:

with open(filename, \"r\") as f:
  data = json.loads(f.read())

(note: the be

11条回答
  •  星月不相逢
    2020-12-01 00:03

    I had a similar problem and it was due to singlequotes. The JSON standard(http://json.org) talks only about using double quotes so it must be that the python json library supports only double quotes.

提交回复
热议问题