I'm using JDK6the standard Scripting. I need to store and retrieve some JavaScript Objects that also contain Java Objects to JSON. I loaded the json2.js into the ScriptENgine and can use it fine without issue if the objects are all created in the Scrip Engine. The moment I try to use my own Java classes, I get some errors like "object does not support toJSON" errors.
I did not find much about JSON in Java Scripting / Rhino context.
Am I doing something totally wrong? What's the best way of achieving the requirement?