Details
-
Enhancement
-
Resolution: Unresolved
-
Major
-
None
-
None
-
None
-
None
Description
When the last expression in a script returns a JSON object, this is returned as String [object Object]. E.g.
var obj = { k: 1, v: 2}
obj
This is because ScriptingEngine's eval method returns an instance of javax.script.Bindings (as ScriptObjectMirror) which is a Map<String, Object>.
Our integration layer should detect the type of the returned object and adjust it for the consumer.
A simple workaround is to wrap the final object around JSON.stringify call, e.g.
var obj = { k: 1, v: 2}
JSON.stringify(obj)