var myJSON =
{"data":
[{"obj1":"value1",
"obj2":"value2"},
{"obj1":"value3",
"obj2":"value4"},
{"obj1":"value5",
"obj2":"value6"}]
};
I've got a multidimensional array similar to above. In the above example I can get value4 by calling data[1].obj2 - the key would be 1 in this case.
My problem: I've got value4 but I don't where it is inside the array (in terms of the key). I know value4 belongs to obj2 and I need to find it's corresponding obj1.
I'm guessing the way to solve this is to figure out what the i should be in data[i] for value4 and then simply call data[i].obj1. But how do I get that i?
"obj1"is the one you need and in that case get the corresponding"obj2"and break the loop.