7👍
✅
You can receive json through request.raw_post_data
data=simplejson.loads( request.raw_post_data )
1👍
the request
variable in your views have a property request.POST
which contains post data. this is (well technically, acts like) a dictionary. you also want to have a look at the json module in python’s standard library
in the end i guess you’ll want something like
def my_view(request):
# error checking omitted here, e.g. what if nothing is posted
# or the json is invalid etc.
posted_json = request.POST['my_json_variable']
my_dict = json.loads(posted_json)
# do something with the data
- [Django]-How install a extension in postgresql before creating the models in django?
- [Django]-Jinja Invalid Filter, filter is built in
Source:stackexchange.com