JSON

B

belred

i tried a couple python json libraries. i used simplejson on the
server and was using cjson on the client, but i ran into this issue.
i'm now using simplejson on both sides, but i'm still interested in
this issue. did i do something wrong? is there a bug in one of the
libraries? or something i don't understand about the json spec?


i problem is the line where i call cjson.decode() below:
'http:\\/\\/server.com' # is this correct????


is that last statement really correct?

thanks,

bryan
 
J

Joshua Kugler

i tried a couple python json libraries. i used simplejson on the
server and was using cjson on the client, but i ran into this issue.
i'm now using simplejson on both sides, but i'm still interested in
this issue. did i do something wrong? is there a bug in one of the
libraries? or something i don't understand about the json spec?


i problem is the line where i call cjson.decode() below:

'http:\\/\\/server.com' # is this correct????

Known issue. See:
http://blog.extracheese.org/2007/07/when-json-isnt-json.html

Neither project has fixed it it seems. Not sure which is actually
the "correct" way to do it, but it would be nice if they would agree.

j
 
M

Marc Christiansen

Joshua Kugler said:
Known issue. See:
http://blog.extracheese.org/2007/07/when-json-isnt-json.html

Neither project has fixed it it seems. Not sure which is actually
the "correct" way to do it, but it would be nice if they would agree.

Since both Opera and SpiderMonkey give http://server.com as result for
eval('"http:\\/\\/server.com"'), I'd say cjson gets it wrong (If by
nothing else than majority rule ;). That is unless I'm wrong that in
javascript something like eval(JSON_repr_of_s) == s should be true.

Marc
 
S

Sion Arrowsmith

Joshua Kugler said:
Known issue. See:
http://blog.extracheese.org/2007/07/when-json-isnt-json.html

Neither project has fixed it it seems. Not sure which is actually
the "correct" way to do it, but it would be nice if they would agree.

I think it's pretty clear (not just from that blog entry, but from
the grammar at http://json.org/) that cjson is incorrectly decoding
"\/". Whether it's sensible for simplejson to be encoding '/' as "\/"
is up for grabs, but it's perfectly correct for it to do so, so one
shouldn't expect it to be "fixed".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top