Here is an example that converts a json string containing a function back to a json object with a valid function declaration.
var jsonstring = "{\"schema\": {\"title\": \"User Feedback\", \"description\":\"so\", \"type\":\"object\", \"properties\":{\"name\":{\"type\":\"string\"}}}," +
"\"options\":{ \"form\":{\"attributes\":{}, \"buttons\":{ \"submit\":{ \"title\":\"It\", \"click\":\"function(){alert('hello');}\" }}} }}";
var jsonData = JSON.parse(jsonstring);
function Iterate(data)
{
jQuery.each(data, function (index, value) {
if (typeof value == 'object') {
Iterate(value);
}
else {
if (value.indexOf("function()") > -1)
data[index] = eval("(" + value + ")");
}
});
};
Iterate(jsonData);
In this case
jsonData.options.form.buttons.submit.click();