I have a json array say
{
"People": {
"Person": [
{"FirstName": "John", "LastName": "Smith"}
{"FirstName": "Joe", "LastName": "Bloggs"}
{"FirstName": "Wendy", "LastName": "Deng"}
]
}
}
And I want to convert this into a javascript array (something like this)
var persons = [ ["FirstName", "John", "LastName", "Smith"], ["FirstName", "Joe", "LastName", "Bloggs"], ["FirstName", "Wendy", "LastName": "Deng"] ];
How do I accomplish this? Hope my question makes sense and I realise the javascript array initialization may not be the correct way to put it.
Thanks.
JSONis a data interchange format, represented as a string.JSONformat can be mapped directly to JavaScript types, includingObjectandArray. You question doesn't go into why you want to do this, and maybe that would help you to understand the uses of JSON and JavaScript objects.