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"]
arr_data.access, I think we can assume that they know about dot notation.
access[0]will translate to"h"in your case.arr_data.access[0]will try to access a method or variableaccessunderarr_datawhich does not exist.access[0]would return'h'butarr_data.access[0]would throw an error becausearr_data.accessisundefined.accessinarr_data.accesshas nothing to do with the variableaccess.