I have a large hierarchical dataset in the App Engine Datastore. The hierarchy is preserved by storing the data in Entity groups, so that I can pull a whole tree by simply knowing the top element key like so:
query = db.Query().ancestor(db.get(key))
The question: How do I now output this data as JSON and preserve the hierarchy?
Google has a utility class called GqlEncoder that add support for datastore query results to simplejson, but it basically flattens the data, destroying the hierarchy.
Any suggestions?