[google-appengine] Re: Converting model objects to JSON

2009-03-09 Thread Let Delete My Apps
Wonderful :-) On Mar 8, 11:02 pm, Bastian Hoyer wrote: > On 7 Mrz., 23:23, Let Delete My Apps wrote: > > > results = [] > > for app in apps: > >     results.append({"appname" : app.appname}) > > just a small tip.. you can write this as > > results = [ {"appname": app.appname} for app in apps ]

[google-appengine] Re: Converting model objects to JSON

2009-03-08 Thread Bastian Hoyer
On 7 Mrz., 23:23, Let Delete My Apps wrote: > results = [] > for app in apps: >     results.append({"appname" : app.appname}) > just a small tip.. you can write this as results = [ {"appname": app.appname} for app in apps ] --~--~-~--~~~---~--~~ You received

[google-appengine] Re: Converting model objects to JSON

2009-03-08 Thread mike.armstro...@gmail.com
Not sure if this is the best way but I wrote a class that all my models inherit. from django.utils import simplejson from google.appengine.ext import db from google.appengine.api import users from datetime import * import string class json(): def getString(self): s= {} p = se

[google-appengine] Re: Converting model objects to JSON

2009-03-07 Thread Let Delete My Apps
An example from my last app: results = [] for app in apps: results.append({"appname" : app.appname}) # for JSONP callback = this.request.get("callback") this.response.headers["Content-Type"] = "text/javascript" callback = "%s(%s)" % (callback, json.write(result)) this.response.out.write(cal

[google-appengine] Re: Converting model objects to JSON

2009-03-07 Thread Mahmoud
The easiest way is to write a to_dict() method on your models, and then call that before converting to json. On Mar 6, 6:28 am, Devraj Mukherjee wrote: > Hi all, > > Quick question about converting model objects in JSON. Have done some > reading and I can't find a way to use simplejson to serial

[google-appengine] Re: Converting model objects to JSON

2009-03-06 Thread Amr Ellafi
check this http://deron.meranda.us/python/comparing_json_modules/ you will have to stuck with a pure python library On Fri, Mar 6, 2009 at 1:28 PM, Devraj Mukherjee wrote: > > Hi all, > > Quick question about converting model objects in JSON. Have done some > reading and I can't find a way to us