title: how to get length of json encoded array in javascript?
body: <p>I have a json encoded array like this:</p>
  
  <pre><code>{
    "ar0":"{\"start\":{\"lat\":22.9939202,\"lng\":72.50009499999999},\"end\":{\"lat\":23.0394491,\"lng\":72.51248850000002},\"waypoints\":[[23.0316834,72.4779436]]}",
  
    "ar1":"{\"start\":{\"lat\":22.9999061,\"lng\":72.65318300000001},\"end\":{\"lat\":23.0420584,\"lng\":72.67145549999998},\"waypoints\":[[23.02237,72.6500747]]}",
  
    "ar2":"{\"start\":{\"lat\":23.0394491,\"lng\":72.51248850000002},\"end\":{\"lat\":22.9999061,\"lng\":72.65318300000001},\"waypoints\":[[23.0016629,72.58898380000005]]}"
  
   } 
  </code></pre>
  
  <p>my quetion is :  </p>
  
  <p>(1) How to find length of this array? <code>//here it is 3</code></p>
  
  <p>(2) How to use it's value?<br>
  <code>//for example:for as0 the value is {\"start\":{\"lat\":22.9939202,\"lng\":72.50009499999999},\"end\":{\"lat\":23.0394491,\"lng\":72.51248850000002},\"waypoints\":[[23.0316834,72.4779436]]}</code></p>
  
  <p><code>javascript code where i use upper things :</code></p>
  
  <pre><code> function setroute(os)
  {
      var wp = [];
      for(var i=0;i&lt;os.waypoints.length;i++)
          wp[i] = {'location': new google.maps.LatLng(os.waypoints[i][0], os.waypoints[i][1]),'stopover':false }
  
      ser.route({'origin':new google.maps.LatLng(os.start.lat,os.start.lng),
      'destination':new google.maps.LatLng(os.end.lat,os.end.lng),
      'waypoints': wp,
      'travelMode': google.maps.DirectionsTravelMode.DRIVING},function(res,sts) {
          if(sts=='OK')ren.setDirections(res);
      })  
  }
  
  function fetchdata()
  {
      var jax = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');
      jax.open('POST','process.php');
      jax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
  
      jax.send('command=fetch')
      jax.onreadystatechange = function(){ if(jax.readyState==4) {                
      alert(JSON.parse(jax.responseText).ar0);
          try {
                  console.log(jax.responseText);
  
            //it is not work
  
          for(var i=0;i&lt;JSON.parse(jax.responseText).length;i++) 
                  {
                    setroute( eval('(' + jax.responseText + ')') );
                  }
              }
          catch(e){ alert(e); }
      }}
  }
  </code></pre>