 <p>How about this? <code>window["yourfunctionname"]();</code></p> <pre><code> var FunctionName = func[before]; if (typeof(window[FunctionName]) === "function") { window[FunctionName](); } </code></pre> <p>OR </p> <pre><code> function myFunc(obj) { var func = $.parseJSON(obj); if (func[before] === "myBefore") { before();} // do some stuff if (func[after] === "myAfter") { after(); } } </code></pre>