title: How convert JSON to array Javascript ? ASP .NET Core MVC and JavaScript
body: <p>I create application ASP.NET Core MVC 2 for show markers on map. I create Model and Controller.</p>
  
  <p>Model:</p>
  
  <pre><code>    public class MarkersModel
  {
  
      public string title { get; set; }
  
      public double lat { get; set; }
  
      public double lng { get; set; }
  
  }
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>    public class MarkersController : Controller
  {
      public IActionResult Index()
      {
          return View("Markers");
      }
  
      public IActionResult GetMarkers()
      {
          //landmarks
          var model1 = new MarkersModel {lat = 53.43382, lng = 14.55559, title = "Galaxy"};
          var model2 = new MarkersModel { lat = 53.42800, lng = 14.55124, title = "Kaskada" };
  
          //buildings
          var model3 = new MarkersModel { lat = 53.43263, lng = 14.55436, title = "Zig-Zag" };
          var model4 = new MarkersModel { lat = 53.43241, lng = 14.55568, title = "Baltica" };
  
          //stops
          var model5 = new MarkersModel {lat = 53.43269, lng = 14.54787, title = "Plac Grunwaldzki" };
          var model6 = new MarkersModel { lat = 53.43186, lng = 14.55485, title = "Plac Rodła"};
  
          //others
          var model7 = new MarkersModel { lat = 53.43133, lng = 14.55519, title = "KFC" };
          var model8 = new MarkersModel { lat = 53.43172, lng = 14.55384, title = "Kurczak z rożna"};
  
          //MarkersModel.
          return Json(new {model1, model2, model3, model4, model5, model6, model7, model8 });
  
          //return Json(new { Response = model1, model2, model3, model4});
  
      }
  }
  </code></pre>
  
  <p>Ajax I'm get data from the controller and place in variable "response" :</p>
  
  <pre><code>function getData() {
  //alert(data["name"]);
  $.ajax({
      url: '/Markers/GetMarkers', //Controller/Akcja
  
      type: 'POST',
      dataType: "json",
      data: JSON.stringify(),
      contentType: 'application/json; charset=utf-8',
  
      success: function(response) {
          initMap(response);
      },
  
      error: function(error) {
          alert('error');
      }
  </code></pre>
  
  <p>in function initMap show Object JSON console.log(data):</p>
  
  <pre><code>function initMap(data) {
  
  console.log(data);
  
      var map = new google.maps.Map(
      document.getElementById('map'),
      { zoom: 10, center: { lat: 53.42894, lng: 14.55302 } });
  
  // test, do not work
  var myMarkers = $.parseJSON(data);
  </code></pre>
  
  <p>}</p>
  
  <p>How conver JSON to array Javascript or how show add markers on map ?</p>