You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A quote as the last character in a comment (maybe followed by a space) will crash the parser:
{
"a" : "b" # this is a quote: "
}
Traceback (most recent call last):
File "xxx.py", line 8, in <module>
print commentjson.loads(a)
File ".../local/lib/python2.7/site-packages/commentjson/commentjson.py", line 63, in loads
raise JSONLibraryException(e.message)
commentjson.commentjson.JSONLibraryException: JSON Library Exception
Exception thrown by JSON library (json): Expecting , delimiter: line 2 column 15 (char 16)
Traceback (most recent call last):
File ".../local/lib/python2.7/site-packages/commentjson/commentjson.py", line 61, in loads
return json.loads('\n'.join(lines), **kwargs)
File "/usr/lib/python2.7/json/__init__.py", line 338, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode
obj, end = self.scan_once(s, idx)
ValueError: Expecting , delimiter: line 2 column 15 (char 16)
This was difficult to find, specially because the line numbers reported do not make sense (they are line numbers after removing the comments, which does not correlate in the general case with the source file, specially if - like I do - you have lots of blank lines or lines with comments-only)
The text was updated successfully, but these errors were encountered:
Sorry for getting around to this so late. I was not maintaining commentjson in between. Got really busy with my day job. I am trying to maintain this now regularly. So expect faster responses.
This is fixed. You can try the latest version of commentjson which addresses this and a lot of other unhandled cases like this.
A quote as the last character in a comment (maybe followed by a space) will crash the parser:
This was difficult to find, specially because the line numbers reported do not make sense (they are line numbers after removing the comments, which does not correlate in the general case with the source file, specially if - like I do - you have lots of blank lines or lines with comments-only)
The text was updated successfully, but these errors were encountered: