Whenever you create a Javascript object and hand that to a Java API, the Nashorn engine wraps it in a ScriptObjectMirror
. The class is not friendly to (de-)serialization and if I remember correctly instances are even tied to a ScriptingEngine instance. So if you want to set such objects as a process variable, I think a good practice is to transform it into a Spin JSON object (e.g. via S(JSON.stringify(javascriptObj))
in your script).
Cheers,
Thorben