I'm transmitting a application/json
in java with a HttpPost
to a server which use Django.
I am performing the transmission as described here: JSON POST request parsing in PHP
How can I create a page that receive this json data ?
I'm transmitting a application/json
in java with a HttpPost
to a server which use Django.
I am performing the transmission as described here: JSON POST request parsing in PHP
How can I create a page that receive this json data ?
You can receive json through request.raw_post_data
data=simplejson.loads( request.raw_post_data )
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