The tittle says most:
I'm storing JSON in the DataStore. All json is getting converted to html entities, how can I avoid this?
Original I had
myJson = db.StringProperty()
it complained the json i had was to long and StringProperty had a limit of around 500 chars. Sugesting to use TextProperty instead.
It inserted without problems but now myJson looks like this when i fetch it from the database:
{ "timeUnit": "14", "taskCounter": "0", "dependencyCounter": "0", "tasks": [], "dependencies": []}
Any sugestions?
Edit:
Code:
Model:
the_json = db.TextProperty()
Saving:
myObjectKey = request.POST["myKey"]
myJson = request.POST["myJson"]
element = myObject.get(myObjectkey)
logging.error(" -------------------------")
element.the_json = myJson
element.put()
Loading:
params = {}
myObjectKey = request.POST["myKey"]
element = myObject.get(myObjectKey)
params['the_json'] = myObject.the_json
return respond(request, "ajax/load.html",params) #this function is a redirect to shortcuts.render_to_response
For ajax I'm using jquery to handle everything. The JSON is a normal string with no '\n' in it.:
json_in_the_js = '{ "timeUnit": ...';