you can try eval function

the eval() function evaluates javascript code represented as a string.

eval(" var s='hello'; alert(s);");


if all of the contents of the #data element is properly formatted, all you'll actually have to do is grab the inner html of that element and parse it into json.

// this is the contents of #data as a string
var data_as_a_string = document.getelementbyid("data").innerhtml;

// and here it is "in javascript" as an object
var data_as_an_object = json.parse( data_as_a_string );

Related Query

More Query from same tag