title: How to calculate length of object being sent in POST
body: <p>I've an object like </p>
  
  <pre><code>{
      "Id": 1,
      "Value": 10,
      "UId" : "ab400"
  }
  </code></pre>
  
  <p>How can I calculate the length of this so that I'm able to send it in ajax request.</p>
  
  <pre><code> $.ajax({
      url: 'http://gdata.youtube.com/feeds/api/videos/keDZXXDxK1c/ratings',
      type:"POST",
      data: data,
      headers: {
          "Content-Type":"application/atom+xml",
          "Content-Length": data.length,
  </code></pre>
  
  <p>I tried using stringfying the JSON but the length comes incorrect 
  Tried : JSON.stringify(data).length</p>