Thanks Michael for you sugestions, I'll look into that!

Michael schrieb:
 Now I am curious if there is also a build-in functionality that objects
 become serialized into json by automatically calling a __json__ function
 on the object??
 When looking at the docs simplejson throws an exception if an object is
 provided for serialization.
    

For lazy translation objects the simplejson still throws an error, but
for the most part objects are translated really well by simple json.
imagine:

  
obj = {'item':{'foo':False,'baz':True, 'boo':('part1','part2')}}
simplejson.dumps(obj)
        
'{"item": {"foo": false, "baz": true, "boo": ["part1", "part2"]}}'
  
simplejson.dumps({'foobar':obj})
        
'{"foobar": {"item": {"foo": false, "baz": true, "boo": ["part1", "part2"]}}}'


For model objects you might need to explicitly define what you want to
pass out. You could also use serialize with a queryset, which is
simple enough to limit to just one object.

This part of Django is changing but for right now this is working
quite well for simple transactions. What else are you trying to
accomplish? The serialization docs are pretty good:
http://www.djangoproject.com/documentation/serialization/

Also there is a lot of interest on this in the community (of course):
http://www.djangosnippets.org/snippets/622/
http://code.google.com/p/django-rest-interface/

Hope that helps,

Michael


  


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to