title: Get json data from angularjs http post request thanks to servlet
body: <p>I try to send data in JSON format from angularJS client thanks to post http request and get it thanks to j2ee servlet. But I meet a mistake. My complete data can be access thanks to getParameterNames method in my servlet and I can't get it in other way.</p>
  
  <p>I don't understand why my data is the Key and not a value.</p>
  
  <p><strong>AngularJS Client</strong></p>
  
  <pre><code>setParametersForTools : function (toolName, data) {
      var jsonData = JSON.stringify(data) // I try with json and stringify json
      var promise = 
      $http({
          url: configuration.root_url_api+"SetParametersServlet?tool="+toolName,
          method: "POST",
          dataType: 'json',
          data: data,
          headers: {'Content-Type': 'application/x-www-form-urlencoded'}
      })          
      .then(function (response){
          console.log(response);
      }, function (error){
          console.log(error);
      })
      return promise;
  }
  </code></pre>
  
  <p><strong>Servlet</strong></p>
  
  <pre><code>protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      String toolname = request.getParameter("tool"); //toolname is correct
  
      String json = request.getParameter("data");  // return null...
  
      Enumeration&lt;String&gt; paramsName = request.getParameterNames();
      for (;paramsName.hasMoreElements();) {
          String paramName=paramsName.nextElement();
          System.out.println("param:"+paramName);
      }
  }
  </code></pre>
  
  <p><strong>Servlet log</strong></p>
  
  <pre><code>//For Parameter names
  param:tool
  param:{ my correct data in json format}
  </code></pre>
  
  <p>Maybe I don't send data correctly but after many searches I don't understand what's wrong.</p>