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

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Mon Jan 26 01:04:40 CET 2009

En Sun, 25 Jan 2009 21:08:04 -0200, gert <gert.cuykens at gmail.com> escribió:
> On Jan 25, 11:51 pm, "Diez B. Roggisch" <de... at nospam.web.de> wrote:
>> gert schrieb:
>> > On Jan 25, 11:16 pm, Дамјан Георгиевски <gdam... at gmail.com> wrote:
>> >>> raise ValueError(errmsg("Expecting property name", s, end))
>> >>>http://docs.python.org/library/json.html
>> >>> What am I doing wrong ?
>> >> try this
>> >> v = json.loads('{"test":"test"}')
>> >> JSON doesn't support single quotes, only double quotes.
>> > It can not be that hard to support both notation can it ?
>> It's not hard, but it's not standard-conform.
>> Most browsers even accept something like this:
>> {foo : "bar"}
>> But all of this is not JSON.
> Yes it is, you just make it more python dictionary compatible :)

What do you mean? The above is not valid Python.
JSON is whatever the author says it is. And he says "A string is a  
collection of zero or more Unicode characters, wrapped in double quotes,  
using backslash escapes".

> What is this json person email address so I can ask that he makes a
> very small update on his site.

Try http://www.json.org/ -- good luck.

> Besides if you can make lightweight versions of standards
> http://docs.python.org/library/xml.dom.minidom.html

This is not a lightweight version of XML, but a lightweight version of an  
API. minidom reads and writes the same valid XML documents.

> You can defenatly add lightweight quotes to json.

JSON is ligthweight *already*: "JSON (JavaScript Object Notation) is a  
lightweight data-interchange format."
Introducing single quoted strings, apart from being incompatible with the  
previous version, would make parsing more complex.

Gabriel Genellina

More information about the Python-list mailing list