JSON serialization of Google App Engine models

后端 未结 14 2115
不知归路
不知归路 2020-12-04 04:59

I\'ve been searching for quite a while with no success. My project isn\'t using Django, is there a simple way to serialize App Engine models (google.appengine.ext.db.Model)

14条回答
  •  暖寄归人
    2020-12-04 05:48

    To serialize a Datastore Model instance you can't use json.dumps (haven't tested but Lorenzo pointed it out). Maybe in the future the following will work.

    http://docs.python.org/2/library/json.html

    import json
    string = json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}])
    object = json.loads(self.request.body)
    

提交回复
热议问题