Why doesn\'t this produce anything?
console.log(JSON.stringify(function(){console.log(\'foobar\');}));
You cannot do that, but there are some third party libraries can help you do that, like: https://www.npmjs.com/package/json-fn