[New-bugs-announce] [issue21451] Improve error messages for malformed JSON
Raymond Hettinger
report at bugs.python.org
Wed May 7 18:51:27 CEST 2014
New submission from Raymond Hettinger:
The error message for malformed JSON just tells you that the JSON is invalid, it doesn't say why (showing you which character bombed, what text is being read, what the pending openers are, or what allowable characters would have been expected). In the absence of this information, it is very difficult to debug hand-rolled JSON.
json.loads('sample_file.json') # students find this hard to debug
json.loads('''[
"boys": 10,
"girls": 20,
]''') # hard to see trailing comma
json.loads("['python', 'perl', 'ruby']") # needs double quotes
json.loads("[[10, 20], [30, 40]]]") # unbalanced delimiters
----------
messages: 218062
nosy: rhettinger
priority: normal
severity: normal
status: open
title: Improve error messages for malformed JSON
type: enhancement
versions: Python 2.7, Python 3.4, Python 3.5
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21451>
_______________________________________
More information about the New-bugs-announce
mailing list