samedi 30 juillet 2016

How do I create sub arrays from a JSON object

I have a JSON object as show here:

[
{
    "ID": "1",
    "Country": "India",
    "Value1": "100",
    "Value2": "200"
},
{
    "ID": "2",
    "Country": "China",
    "Value1": "230",
    "Value2": "800"
}
]

This is the result that I am looking for:

[
        ['India', 100],
        ['China', 230],
    ]

I tried using Jquery $.map function but was unable to get what exactly I wanted. Any pointers would be appreciated.

Aucun commentaire:

Enregistrer un commentaire