String with functions to JSON -
i need turn string:
"{ click : myclickfunction, render : myrenderfunction }"
or variation of it,
into :
{ click : myclickfunction, render : myrenderfunction }
where myclickfunction
, myrenderfunction
functions defined else , not strings
try this:
function myclickfunction (test) { return "foo"; } function myrenderfunction (test) { return "bar"; } var mystring = "{click : myclickfunction,render : myrenderfunction}"; var obj=eval("("+mystring+")"); console.log(obj); console.log(obj.click()); console.log(obj.render());
Comments
Post a Comment