javascript - Reading Dynamic JSON Array -


i trying build javascript function grab json encoded array , return value based on requested key. use jquery $.parsejson() method take json string , convert javascript object. here watered down example:

function getvalue(dynamicarraykey) {   var thearray = $.parsejson(/* json source using jquery */);    alert('here value: ' + thearray.dynamicarraykey); } 

so key want given function, , should return resulting value. thinking javascript eval() method should used in there somewhere, i'm not sure. appreciated.

there's no need eval(), use

alert('here value: ' + thearray[dynamicarraykey]); 

Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -