Convert json data to javascript array - in multi-dimensional sense
Posted
by
AW-GWTF899
on Stack Overflow
See other posts from Stack Overflow
or by AW-GWTF899
Published on 2012-11-28T10:49:02Z
Indexed on
2012/11/28
11:03 UTC
Read the original article
Hit count: 378
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.
© Stack Overflow or respective owner