Reputation: 161
I am new to python and I am pretty sure that I am doing something very stupid..
I have a string:
s = '{"l":1,"oE":{"n":"name","rN":["1","2","3","3","5","6","7","8","9","10"],"dir":"out","ed":["1","1","1","1","1","1","1","1","1","1"]}'
I did json.loads(s)
But I am getting an error?
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/json/__init__.py", line 328, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 365, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.7/json/decoder.py", line 381, in raw_decode
obj, end = self.scan_once(s, idx)
ValueError: Expecting , delimiter: line 1 column 72 (char 72)
Upvotes: 0
Views: 1422
Reputation: 14136
You're missing a quotation mark in your code. Also a closing brace. Instead of:
s = '{"l":1,"oE":{"n":"name","rN":["1","2","3","3","5","6","7","8","9","10],"dir":"out","ed":["1","1","1","1","1","1","1","1","1","1"]}'
use
s = '{"l":1,"oE":{"n":"name","rN":["1","2","3","3","5","6","7","8","9","10"],"dir":"out","ed":["1","1","1","1","1","1","1","1","1","1"]}}'
You can figure this out from your stack trace:
ValueError: Expecting , delimiter: line 1 column 72 (char 72)
If you look at the 72nd character in that line, you'll see that's where the error occurs.
Upvotes: 2