Reputation: 489
All:
We are using NEwtonsoft JSON.NET to serialize some C# POCOs, and we get the following:
{
"RouteID": "123321213312",
"DriverName": "JohnDoe",
"Shift": "Night",
"ItineraryCoordinates": [
[ 9393, 4443 ],
[ 8832, 3322 ],
[ 223, 3432 ],
[ 223, 3432 ]
]
}
In an AJAX jQuery function, I have the following:
alert($.parseJSON(data.d).ItineraryCoordinates);
Sadly, the result in the popup alert box is:
9393, 4443 , 8832, 3322, 223, 3432, 223, 3432
Could someone please tell me how I can implement the code in such a way that the square brackets are kept in place?
Upvotes: 0
Views: 72
Reputation: 337560
You can use JSON.stringify
to achieve what you require:
var data = $.parseJSON(data.d);
alert(JSON.stringify(data.ItineraryCoordinates));
Upvotes: 3