I have a requirement where I convert a function that is in JSON to a JS object. How can I do that? For example,
If I have the JSON object like:
{"obj":{ "a": "abc", "b": "(v) => { console.log('Hi', v) }" } }
Then I want the above JSON to convert it back to the original object:
const obj = { a: 'abc', b: (v) => { console.log('Hi', v) } }
Is this possible? And can it be done without using eval?
Currently when I do stringify & parse the function is getting ignored
Also I want to add that I want to construct the desired JS object but not actually evaluate/run the function.