I\'m getting started with Google App Engine. I want to make AJAX chat like Twitter.
class ChatMessage(db.Model):
message = db.StringProperty()
created =
I use gson for GAE/J. You can give it an object (or in your case, extract stuff from a result-set) and get a JSON string.
Check the error log for the app engine. It will tell you what error it is experiencing. Probably you are trying to encode a Python type that json it not familiar with. JSON will only do simple stuff like lists and dictionaries. You can't use it for complex, custom types.
In App Engine Python you can use this script to encode db.Models to JSON. You may have to customize some parts, like the DateTime formatting.
http://code.google.com/p/google-app-engine-samples/source/browse/trunk/geochat/json.py?r=55
You can't use simplejson.dumps() on a list of db.Model items directly.
See my answer for extending db.Model with some handy methods for serialising db.Model instances