70
rated 0 times
[
72]
[
2]
/ answers: 1 / hits: 22678
/ 10 Years ago, fri, january 9, 2015, 12:00:00
Let say We have the following json object:
[{a1 : a1Val, a2 : a2Val, a3 : a3Val},
{b1 : b1Val, b2 : b2Val, b3 : b3Val},
....
{z1 : z1Val, z2 : z2Val, z3 : z3Val}]
How can we retrieve from this object array of only X2 key value pairs.
meaning, the following result:
[ {a2 : a2Val}, {b2 : b2Val}, ... ,{ z2 : z2Val}]
within the best performance.
The key does not have to contains number.
What I need here is a function that will recieve parameter - i
and return an array of all the i-th objects in the original json object
So for example if we look at the above json object
and we invoke the method we 2 the method will return
[ {a2 : a2Val}, {b2 : b2Val}, ... ,{ z2 : z2Val}]
Hope it's clear enough.
More From » arrays