In my controller I have the following code to generate a Json response whenever a particular URL is hit.
public JsonResult LatLng()
{
var zones = zoneRepository.GetCoordinates().ToList();
return Json(zones, JsonRequestBehavior.AllowGet);
}
The output looks like this.
[{"Zip_Code":1001,"City":"Agawam","DMA":"SPRINGFIELD, MA"},...
My question is the following. Shouldn’t there be an array name preceding the Json array? For example:
{"zones":[{"Zip_Code":...
When I parse this using Jquery I need to use something along the lines of $.each(json.zones so I’m wondering how to include the array name in the Jason response. Thanks!
try