Hello: I'm Trying to serialize a dict which have a list of Model's instance. The format that i need is json. Something like that:
people = Person.objects.all() res = {'res':0, 'msg':'Ok','data': people} .... but, i need that result: {'res':0, 'msg':'Ok','data': [{'id':1,'name':'Sean'}, {'id':1,'name':'Steve'}]} When I tried: simplejson.dump(res) I had this error: [<Person: Person object>, <Person: Person object>] is not JSON serializable When I tried: json_serializer = serializers.get_serializer("json")() json_serializer.serialize(object, ensure_ascii=False) I had this error: 'str' object has no attribute '_meta' please, help --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---