I am trying to create a properly formatted json object for use in javascript. I tried simplejson.dumps (string), but it behaves differently on my local machine (in the python shell) and on the server (the google engine is running). For example, locally I will get:
>>> s= {u'hello': u"Hi, i'm here"}
>>> simplejson.dumps(s)
'{"hello": "Hi, i\'m here"}'
which looks good. But when I run it on the server, I get
{"hello": "Hello, I'm here"}
where the single quote is not escaped, which causes an error in my javascript.
Finishing secondary string.replace("'", r"\'"), does anyone have any suggestions? I am at a loss and have spent a lot of time trying to figure it out ...