Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

JSON object in Scoped Application

hmartind
Kilo Expert

Hello,

Working on a Helsinki instance,

var json = new JSON();

Works fine in the Global Scope but crashes within an Scoped Application:

Invalid object in scoped script: org.mozilla.javascript.gen.sys_script_include_04cf1a2f0fd2020094f3c09ce1050eba_905@1cadf34

{"error":{"detail":"TypeError: org.mozilla.javascript.NativeJSON@7737e3 is not a function. (sys_script_include.1d264e71dbd83200b7bbd001cf961986; line 7)","message":"org.mozilla.javascript.NativeJSON@7737e3 is not a function."},"status":"failure"}

Any idea how to solve this issue?

Many thanks.

5 REPLIES 5

Mike Allen
Mega Sage

Try:



var json = new global.JSON();


This worked, too bad it wasn't marked as the answer.

Worked for me too. Thanks a lot!

Deepak Ingale1
Mega Sage

From Helsinki, i guess JSON.stringify() and JSON.parse() are supported in both Server and Client side.


Not sure about Scoped apps though.