We have json. In json have 10 latitude and 10 longitude.We tried draw line between those points.But We got Status code google.maps.DirectionsResult.MAX_WAYPOINTS_EXCEEDED.So after deleted two points.Now We tried to draw the lines between 8 points it's working nice. But in json some time come 50 to 100 latitude and longitude.We tried like this
 var aa=waypts[0].location.k;
  var bb=waypts[0].location.D;
  var cc=waypts[waypts.length-1].location.k
  var dd=waypts[waypts.length-1].location.D;
var start1= new google.maps.LatLng(aa,bb);
var end1=new google.maps.LatLng(cc, dd);
  var request = {
      origin: start1,
      destination: end1,
      waypoints: waypts,
      optimizeWaypoints: true,
      travelMode: google.maps.TravelMode.DRIVING
  };
  debugger;
  directionsService.route(request, function(response, status) {
  debugger;
    if (status == google.maps.DirectionsStatus.OK) {
      directionsDisplay.setDirections(response);
      var route = response.routes[0];
    }
  });
first tell me how to draw line between more then 8 points.Please guide me