Menu Close

How to receive JSON data using HTTP POST request in Python Django?

Sometimes, we want to receive JSON data using HTTP POST request in Python Django.

In this article, we’ll look at how to receive JSON data using HTTP POST request in Python Django.

How to receive JSON data using HTTP POST request in Python Django?

To receive JSON data using HTTP POST request in Python Django, we can use the request.body property in our view.

For instance, we write

received_json_data=json.loads(request.body)

to call json.oads with request.body to parse the JSON request body into a dictionary.

Conclusion

To receive JSON data using HTTP POST request in Python Django, we can use the request.body property in our view.

Posted in Python, Python Answers