Hi,

Whats the best way to do $subject ?

The primitive way is to use

var obj = eval("(" + jsonStr + ')');

but thats vulnerable to executing anything other than simple JSON.

I did find a lot of samples using

JSON.parse(jsonStr)

But when trying this out, ESB fails to identify JSON module within the
script mediator.

Caused by: org.mozilla.javascript.EcmaError: ReferenceError: "JSON" is not
defined. (<Unknown source>#1)
    at
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3350)
    at
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3340)
    at
org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3413)
    at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1612)

Please advice. Are there any other in-built functions that can be used ?

-- 
Cheers,
Hasitha Amal De Silva
Software Engineer
Mobile : 0772037426
Blog    : http://devnutshell.tumblr.com/
WSO2 Inc.: http://wso2.com ( lean.enterprise.middleware. )
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to