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

后端 未结 11 1009
既然无缘
既然无缘 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-11-30 23:58

    You wont be able to get python to tell you where the JSON is incorrect. You will need to use a linter online somewhere like this

    This will show you error in the JSON you are trying to decode.

提交回复
热议问题