Rohit,
@Ryan - This is a simpler json string example below. This too does not work for
me when i run: recData["runFunction"]();
{"runFunction":"function(){'use strict';\nvar net =
require(\"net\");\n\nconsole.log(\"NET\");\n}"}
Try it yourself on the console as I do here and see what you get. I say this
because I don't see any problems, see below. Or, alternatively, maybe you need
to be clearer about what you mean by "does not work".
> var recDataString = JSON.stringify({
... "runFunction": "function(){'use strict';\nvar net =
require(\"net\");\n\nconsole.log(\"NET\");\n}"
... });
> var recData = JSON.parse(recDataString, function (key,value) {
... if (value && (typeof value === 'string') && key.indexOf("runFunction") ===
0) {
..... return new Function('return ' + value)();
..... }
... return value;
... });
> recData
{ runFunction: [Function] }
> recData["runFunction"]()
NET
>
--
Job board: http://jobs.nodejs.org/
New group rules:
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/etPan.53d42290.6b8b4567.b0da%40sierra.
For more options, visit https://groups.google.com/d/optout.