[New-bugs-announce] [issue10216] json.loads() on str erroneously returns str

Barry A. Warsaw report at bugs.python.org
Wed Oct 27 22:41:17 CEST 2010

New submission from Barry A. Warsaw <barry at python.org>:

json is defined as mapping the JSON string type into unicodes.  This works as advertised in Python 2.6 and 3, but in Python 2.7 it returns a str.

% python2.6 -c "import json; print json.loads('{\"foo\":\"bar\"}')"
{u'foo': u'bar'}
% python2.7 -c "import json; print json.loads('{\"foo\":\"bar\"}')"
{'foo': 'bar'}

Platform tested so far: Ubuntu 10.10 amd64.

messages: 119732
nosy: barry
priority: critical
severity: normal
status: open
title: json.loads() on str erroneously returns str
type: behavior
versions: Python 2.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list