I need access to h_00
with other variable, any idea?
var json = '{"h_00":[["bus",28,"F"],["bus",71,"M"],["car",16,"M"]]}';
var arr_data = jQuery.parseJSON(json);
var access = "h_00";
alert(arr_data.access[0]);
I need access to h_00
with other variable, any idea?
var json = '{"h_00":[["bus",28,"F"],["bus",71,"M"],["car",16,"M"]]}';
var arr_data = jQuery.parseJSON(json);
var access = "h_00";
alert(arr_data.access[0]);
Use bracket notation:
arr_data[access][0]; // ["bus", 28, "F"]
Also that is not called a string array. It is an object.
If you that standard JSON parser it will accomplish your task:
var json = '{"h_00":[["bus",28,"F"],["bus",71,"M"],["car",16,"M"]]}';
var obj = JSON.parse(json);
You can simply access your property:
obj.h_00
And obj.h_00[0]
Will output:
["bus", 28, "F"]