Does django not do this automatically?  https://docs.djangoproject.com/en/1.4/topics/serialization/