1, JSON string considerations: Key and value are double quotation marks, the official website is specified with double quotation marks, as follows:
var mapstr= ' {' A ': ' A ', ' B ': ' B '} ';
var map=json.parse (MAPSTR);
So by stitching strings, JSON parsing gets keyvalue
var str= ' a ';
map[str];//output A
2, also by stitching the string to get keyvalue, using the Eval method to parse the array, note that the arrays
var mapstr= ' [{"A": "A", "B": "B"}] ';
var map=eval (MAPSTR) [0];
map[' A '];//output a
3, there is a more troublesome, is to set the object {Name:key,value:val}, the object is stored multiple times, transform key and Val to get the corresponding data, traversing the name key for the desired value when the Val;
JS implementation of dynamic key value (JSON string considerations: Key and Value are double quotes, the official website is specified in double quotation marks)