Python JSONDecode错误,因为数字以0开头

时间:2015-02-19 19:58:22

标签: python json

我正在尝试使用请求加载json文件,但我收到错误

>>> r = requests.get('urlto.json').json()

JSONDecodeError: Expecting ',' delimiter or '}': line 11 column 418 (char 6232)

这是有问题的json:

{"Resource Name":"","Contact Name":null,"Contact Email":null,"Primary Phone":"","Primary Phone Ext":null,"Alternate Phone":null,"Alternate Phone Ext":null,"TTY":null,"Website URL":"","Website Tiny URL":null,"Website Name":null,"Email":"","Street Address":"","Street Address 2":null,"City":"","State":"MA","Postal Code":01331,"Description":null,"Category":null,"Tags":null,"Notes":null,"Services":null,"Longitude":null,"Latitude":null,"Thumbnail":null},

问题是邮政编码以0开头。之前的其他邮政编码不会引发错误。如果我引用该邮政编码,它不会引发错误。我怎么能绕过这个?

1 个答案:

答案 0 :(得分:0)

是的,我现在看到它是无效的json。谢谢

如何关闭/删除此问题?