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.

Error using using global.JSON.stringify() in scoped application - 'Evaluator.evaluateString() problem: java.lang.ClassCastException:'

jarethdisley
Kilo Contributor

I am getting this error 'Evaluator.evaluateString() problem: java.lang.ClassCastException:' when using global.JSON.stringify() in a scoped application - Any ideas why?

In my opinion JSON.stringify should work for any valid Javascript object - Is this not the case?

1 ACCEPTED SOLUTION

I tried it on Helsinki with no issues. Helsinki uses ECMAScript5 by default and may be more resilient to this sort of thing. If you have upgraded to Helsinki, your app is likely still using ES3. You can change it on the app settings.



I tried your simple script in Geneva and it kept failing with a numeric object property name (1). As soon as I changed it to 'a', it worked fine. That's what leads me to believe this is an ES3 vs ES5 thing.


View solution in original post

11 REPLIES 11

If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.



If you are viewing this from the community inbox you will not see the correct answer button.   If so, please review How to Mark Answers Correct From Inbox View.



Thank you


cameronrichard
ServiceNow Employee
ServiceNow Employee

I'll get that raised!



I am unable to recreate it in my development environment (post Helsinki). I'll do some looking around and figure out what the real cause is.



Thanks,



Cameron