title: How can I count the elements of an array in jquery?
body: <p>I try to count the items of my array:</p>
  <pre><code>  $.ajax({
        method:'POST',
        data: {
          &quot;id&quot;: id,
        },
        success : function (data) {
          var obj = JSON.parse(data);
          var count = obj.length;
          console.log(count);
        }
    });
  </code></pre>
  <p>the output of data:</p>
  <pre><code>{&quot;1&quot;:&quot;horse&quot;,&quot;2&quot;:&quot;cat&quot;,&quot;3&quot;:&quot;monkey&quot;,&quot;4&quot;:&quot;bird&quot;}
  </code></pre>
  <p>the output of count:</p>
  <pre><code>undefined
  </code></pre>
  <p>I expect the output of count to be <code>4</code>.</p>
  <p>If I try to write <code>data.length</code> I get the result <code>69</code>.</p>