Hi, I am trying to parse json, loop through it and access its data. At first I tried this:
for obj in serializers.deserialize("json", p): a=2 response = HttpResponse() response.status_code = 200 return response Here 'p' has the json data returned to me by another view. I have validated it in http://www.jsonlint.com/ and it does not have any error. This gave attribute error. AttributeError at /bookings/52/cancel/ 'HttpResponse' object has no attribute 'read' The problem I am sure is not in HttpResponse object as it works fine when I comment out the line accessing object of deserialized data i.e for obj in serializers.deserialize("json", p) I then tried writing this: deserialized = serializers.deserialize("json", self.request.raw_post_data) d = list(deserialized)[0].object and also this: deserialized = serializers.deserialize("json", self.request.raw_post_data) d = list(deserialized).object I again get same error. It works fine if the second line: put_bookmark = list(deserialized)[0].object , is commented out. But, when I uncomment it to access object of deserialized data I get the same error. After many trial and errors, I am convinced the problem is when I try to access object of deserialized data. I also referred to this thread: http://groups.google.com/group/django-users/browse_thread/thread/87bd6951b4aebd00/d8e0a547be1583a8?lnk=gst&q=deserialize#d8e0a547be1583a8 in the discussion group. In this thread also the problem trickles down to access object of deserialzed data but no further solution is available. I don want to use simplejson. Can someone give me a solution to this problem and help me fix this. Thanks, Irum I get the attribute error: 'HttpResponse' object has no attribute 'read' -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.