タイトルは最も言います:
JSON を DataStore に保存しています。すべての json が html エンティティに変換されています。これを回避するにはどうすればよいですか?
持っていたオリジナル
myJson = db.StringProperty()
私が持っていたjsonが長すぎて、StringPropertyには約500文字の制限があると不平を言いました。代わりに TextProperty を使用することを提案します。
問題なく挿入されましたが、データベースから取得すると myJson は次のようになります。
{ "timeUnit": "14", "taskCounter": "0", "dependencyCounter": "0", "tasks": [], "dependencies": []}
何か提案はありますか?
編集:
コード:
モデル:
the_json = db.TextProperty()
保存:
myObjectKey = request.POST["myKey"]
myJson = request.POST["myJson"]
element = myObject.get(myObjectkey)
logging.error(" -------------------------")
element.the_json = myJson
element.put()
読み込み中:
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
ajaxの場合、jqueryを使用してすべてを処理しています。JSON は、'\n' を含まない通常の文字列です。
json_in_the_js = '{ "timeUnit": ...';