What is the actual content of request.body? (as in, "print request.body")

On Sun, Jun 21, 2015 at 9:26 AM, Dhaval M <[email protected]> wrote:

> Thank you in advance for any help (this is my first post to this community)
>
> I am using Django as my application server for my project. I am new to web
> development so please pardon and feel free to correct me for any mistake.
>
> I am running simple, client server combination where from client I am
> trying to send JSON data and on the server I am trying to parse it.
>
> SERVER CODE:
>
> def addPatient(request):
>
>      if request.method == 'POST':
>
>         # Convert JSON to python objects and
>
>         # store into the DB
>
>         recJSON = json.loads(request.body)
>
>         #logger.debug("%s",recJSON['SenderID'])
>
>         logger.debug("%s",request.body)
>
>
>         #print 'Raw Json "%s"' % request.body
>
>         return HttpResponse(json.dumps(request.body),content_type=
> "application/json")
>
>
>
>
> But getting an error at json.loads. ValueError: No JSON object could be
> decoded
>
>
> Also I would appreciate if any one can direct me to good tutorial on
> Django (I already read http://www.djangobook.com/)
>
>
> I dont know where and what I am doing wrong. I checked the client side
> message and it is JSON used http://jsonlint.com/ to validate it is JSON
> data.
>
>
> Thank you once again.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/5bc51870-6b56-456f-bc6d-18cf20487265%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/5bc51870-6b56-456f-bc6d-18cf20487265%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALn3ei1Sdb_QGG3hxixj2RNqiqaafjQMkwqGkpokXqcCOGgejA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to