I was able to get this to work. There was an import error from my side, data = serializers.serialize('json',Food.objects.filter(group__exact=my_group),fields=('food_name','group','description'))
following two serialization ways gave me exception - 'dict' object has no attribute '_meta' a) json_out_list= serialize('json',out_list) json_serializer = serializers.get_serializer("json")() json_out_list = json_serializer.serialize(out_list, ensure_ascii=False) so I am unblocked for now. Thanks everyone thanks Ashish Gupta On Mar 31, 11:49 am, ydjango <[EMAIL PROTECTED]> wrote: > I am on svn version as of two days back. > > I am using values(*fields) to create an output from my table. > (following using print statement) > > out_list=Food.objects.filter(group__exact=my_group).values('food_name','group','description') > print out_list > > [{'food_name': u'nirvana', 'group': 1L, 'description': u'nirvana1'}, > {'food_name': u'dj new versio', 'group': 1L, 'description': > u'jsklajdkls'}, {'food_name': u'PMC', 'group': 1L, 'description': > u'jsklajdkls'}] > > ( why do I see u before text in output above?) > > when I try json serailize It throws an exception: > > i tried following, none seems to work, any clues- > > from django.core.serializers import serialize > a) json_out_list= serialize('json',out_list) > b) json_serializer = serializers.get_serializer("json")() > json_out_list = json_serializer.serialize(out_list, > ensure_ascii=False, stream=response) > c) data = serializers.serialize('json', > Food.objects.filter(group__exact=my_group), > fields=('food_name','group','description')) > > Any clues? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---