title: how to parse json data with ajax POST in Django view
body: <p>I'm trying to parse json data in django view. But I got a problem.</p>
  
  <p>I'm using below code snippet.</p>
  
  <pre><code>$(document).ready(function(){
      $("#mySelect").change(function(){
          selected = $("#mySelect option:selected").text()
          $.ajax({
              type: 'POST',
              dataType: 'json',
              contentType: 'application/json; charset=utf-8',
              url: '/test/jsontest/',
              data: {
                     'fruit': selected,
                    },
              success: function(result) {
                      document.write(result)
                      }
      });
    });
  });
  </code></pre>
  
  <p>when the client side user change the value, ajax code send json data.
  But server side view receive a data in forms with "fruit=apple".
  I think it's not json data format. So, I have no idea how to parse the data.</p>
  
  <p>I try to parse like below, But I got 500 Internal server error after calling json.dumps(data) </p>
  
  <pre><code>class JsonRead(View):
      template_name = 'MW_Etc/jsonpost.html'
      def get(self,request):
          return render(request, self.template_name)
  
      def post(self,request):
          data = request.body
          logger.debug('json data received(%s)' % data)
          return HttpResponse(json.dumps(data), content_type='application/json')
  </code></pre>