As Luke Plant pointed out a few years ago, you *can* just do:
def serialize_one_object_to_json(obj):
return serializers.serialize("json", [obj])[1:-1]
But, since you almost always want this exact behavior when serializing a
single object, it seems like this is a good candidate for functionality to
add to serializers.serialize itself.
--
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-developers/-/2T5reILz_q8J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-developers?hl=en.