[New-bugs-announce] [issue5067] Error msg from using wrong quotes in JSON is unhelpful

Steven D'Aprano report at bugs.python.org
Mon Jan 26 07:24:33 CET 2009


New submission from Steven D'Aprano <steve at pearwood.info>:

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 <report at bugs.python.org>
<http://bugs.python.org/issue5067>
_______________________________________


More information about the New-bugs-announce mailing list