Assuming this JSON object:
var obj = {
\"set1\": [1, 2, 3],
\"set2\": [4, 5, 6, 7, 8],
\"set3\": [9, 10, 11, 12]
};
The \"set
Jeroen Vervaeke's answer is modular and the works fine, but it can cause problems if it is using with jQuery or other libraries that count on "object-as-hashtables" feature of Javascript.
I modified it a little to make usable with these libs.
function getByIndex(obj, index) {
return obj[Object.keys(obj)[index]];
}