- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2016 03:23 AM
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?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2016 07:38 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2016 06:24 AM
Hi Jareth,
You're correct, the problem is the integer you're trying to use as the key for your object. I can recreate this using a Geneva and Helsinki.
A simple solution would be to prefix it with some constant to get around this.
Thanks,
Cameron
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2016 06:27 AM
Thanks for your assistance with this, I will have to use a prefix for now but still think this is an underlying issue with either the platform of Rhino - I will try and get this raised as a defect!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2016 07:25 AM
Runs fine for me in a scope. I just ran it from Scripts Background, selected one of my scoped apps and got this for the output.
x_66238_mars: {"1":"hello"}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2016 07:26 AM
Hey Chuck
What release is your instance running on?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2016 07:38 AM
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.
