title: Getting waypoints from leaflet routing machine
body: <p>I'm trying to get the waypoints from a route (leaflet routing machine) as latitude and longitude so I can write these out to a database. However when I call getwaypoints I also get additional data about the route that I <strong>don't</strong> want.</p>
  
  <p>How do i get just the lat/long as JSON so I can write it out to a db?</p>
  
  <pre><code>    var map = L.map('map').setView([-27.54, 152.9], 10);
      L.tileLayer('http://{s}.basemaps.cartocdn.com/light_all//{z}/{x}/{y}.png', {
      attribution: '&amp;copy; &lt;a href="http://www.openstreetmap.org/copyright"&gt;OpenStreetMap&lt;/a&gt; &amp;copy; &lt;a href="http://cartodb.com/attributions"&gt;CartoDB&lt;/a&gt;',
      maxZoom: 19
  }).addTo(map);
  
  var routeControl = L.Routing.control({waypoints: [
      L.latLng(-27.38851, 153.11606),
      L.latLng(-27.47577, 153.01693)
    ]}).addTo(map);
  
    var routeArray = new Array();
    routeArray = routeControl.getWaypoints();
  
    alert (JSON.stringify(routeArray));
  </code></pre>
  
  <p>Output</p>
  
  <pre><code>[{"options":{"allowUTurn":false},"latLng":{"lat":-27.38851,"lng":153.11606},"_initHooksCalled":true},{"options":{"allowUTurn":false},"latLng":{"lat":-27.47577,"lng":153.01693},"_initHooksCalled":true}]
  </code></pre>
  
  <p>Please see example fiddle: <a href="http://jsfiddle.net/drcccx91/8/" rel="nofollow">http://jsfiddle.net/drcccx91/8/</a></p>