v = json.loads("{'test':'test'}")

Peter Otten __peter__ at web.de
Sun Jan 25 16:38:33 EST 2009


gert wrote:

> raise ValueError(errmsg("Expecting property name", s, end))
> http://docs.python.org/library/json.html
> What am I doing wrong ?

You need proper quotation marks:

>>> s = json.dumps({'test':'test'})
>>> s
'{"test": "test"}'
>>> json.loads(s)
{u'test': u'test'}

The JSON format is described here: http://www.json.org/

Peter



More information about the Python-list mailing list