Django serializer gives 'str' object has no attribute '_meta' error Django serializer gives 'str' object has no attribute '_meta' error json json

Django serializer gives 'str' object has no attribute '_meta' error


I get the same error when trying to serialize an object that is not derived from Django's Model


Python has "json" module. It can 'dumps' and 'loads' function. They can serialize and deserialize accordingly.


Take a look at the following:

objects= Session.objects.aggregate(Max('date'), Min('date'))print [ type[o] for o in objects ]result =  serializers.serialize("json", objects, ensure_ascii=False)

You might want to just run the above in interactive Python as an experiment.

What type are your objects? Is that type serializable?