JSON
belred at gmail.com
belred at gmail.com
Thu Dec 6 11:50:52 EST 2007
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:
>>> import simplejson
>>> import cjson
>>>
>>> sj = simplejson.dumps('http://server.com')
>>> sj
'"http:\\/\\/server.com"'
>>> cj = cjson.encode('http://server.com')
>>> cj
'"http://server.com"'
>>> simplejson.loads(cj)
u'http://server.com'
>>> cjson.decode(cj)
'http://server.com'
>>> simplejson.loads(sj)
u'http://server.com'
>>> cjson.decode(sj)
'http:\\/\\/server.com' # is this correct????
is that last statement really correct?
thanks,
bryan
More information about the Python-list
mailing list