title: How to get JSON data from POST request using Servlet
body: <p>This is my code on the client side:</p>
  
  <pre><code> $.ajax({
                      type:'POST',
                      charset:'utf-8',
                      url:'http://localhost:8180/GisProject/MainService',
                      data:JSON.stringify(params),
                      success:function(msg)
                      {
                          console.log(msg);
                      },
                      error:function(xhr,status)
                      {
                          console.log(status);
                      },      
                      contentType:"application/json"  
              });
  </code></pre>
  
  <p>I have previously parsed this data in Node using <code>express.bodyParser</code> but now I have to parse it using the <code>servlet</code>.I have seen people assign variables here without using <code>JSON.stringify</code> and getting that variable using <code>request.getParameter(myData)</code>.</p>
  
  <p>What is the standard way of getting the <code>JSON</code> data into the <code>servlet</code>?</p>
  
  <p>And why do people seem to be sending <code>Javascript objects</code> with JSON embedded as a String within like <code>data:{mydata:JSON.stringify(actualData)}</code>?</p>
  
  <p>In case I was not being clear,I want to use the <code>doPost</code> method's <code>request</code> object to get the data I sent from the client side.</p>