Having a JSON string (shortened):
{"line_array":[{"short":"[common]","long":"undefined"},{"short":"_YES","long":"Yes"},{"short":"_NO","long":"No"},{"short":"_NOT","long":"Not "},{"short":"_SEARCH","long":"Search"},{"short":"_GO","long":"Go"}]}
I would like to be able to call a function that returns the "long" value based on the "short" value:
like:
var test= 'Say '+get_value("_YES");
How can I do this?
Tried :
function f_lang(short_string) {
var obj = json_string;
var arr = [];
json = JSON.stringify(eval('(' + obj + ')')); //convert to json string
arr = $.parseJSON(json); //convert to javascript array
return arr['line_array'][short_string];
}
with no luck