我正在尝试在 python 中解析以下 json 文本,但出现错误,尽管我能够使用Json Viewer解析此 json 文本。所以我想我的 json 文本是正确的,有人可以帮我看看这里有什么问题吗?
import json as j
data = '{"c":[{"xy":{"xstart":0,"xend":5,"ystart":1,"yend":5},"names":["D","T","O","H","L","C",],"co":["rgb(0,0,128)"]}],"Values":{"D":["11/30/2012"],"T":["09:44:00"],"O":["5848.40"],"H":["5848.40"],"L":["5847.45"],"C":["5848.40"]}}'
json_data = j.loads(data)
#print json_data["c"][0]
Traceback (most recent call last):
File "C:json\jsonexample.py", line 4, in <module>
json_data = j.loads(data)
File "C:\Python27\lib\json\__init__.py", line 326, in loads
return _default_decoder.decode(s)
File "C:\Python27\lib\json\decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Python27\lib\json\decoder.py", line 384, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded