New submission from Steven D'Aprano <[email protected]>:
Using the wrong sort of quotes in json gives unhelpful error messages:
>>> json.loads("{'test':'test'}")
Traceback (most recent call last):
...
ValueError: Expecting property name: line 1 column 1 (char 1)
Unless you know that strings in JSON must be delimited with
double-quotes and not single (a very surprising fact to those used to
Python) this error message is perplexing. I suggest something like:
Single-quoted strings are invalid property names: line 1 column 1
(char 1)
or
Parse error, invalid char: line 1, column 1 (char 1)
----------
messages: 80564
nosy: stevenjd
severity: normal
status: open
title: Error msg from using wrong quotes in JSON is unhelpful
versions: Python 2.6
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue5067>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com