Is it possible to make something like this without using eval?
foo1 = {"x": 4};
foo2 = {"x": "someFunc(foo1.x)"};
someFunc(var1)
{
return (var1 + 1);
}
alert(foo1.x); // 4
alert(foo2.x); // 5 (hopefully)
Actually this is two problems. The first is to get a function to execute and the second is to do so without the parentheses, because in a loop I don't know if it's foo2.x or foo2.x().
The best thing I can think of is to search the JSON objects for keywords representing functions and use a switch list to execute them and replace the keywords with the value.
The disadvantage is that I need to update the JSON object every time something changes.
{"x": function () { someFunc(foo1.x); } }