[infinispan-issues] [JBoss JIRA] (ISPN-9441) Support script execution returning JSON objects

Galder Zamarreño (JIRA) issues at jboss.org
Tue Aug 21 03:17:00 EDT 2018


Galder Zamarreño created ISPN-9441:
--------------------------------------

             Summary: Support script execution returning JSON objects
                 Key: ISPN-9441
                 URL: https://issues.jboss.org/browse/ISPN-9441
             Project: Infinispan
          Issue Type: Enhancement
            Reporter: Galder Zamarreño


When the last expression in a script returns a JSON object, this is returned as String {{[object Object]}}. E.g.

{code}
var obj = { k: 1, v: 2}
obj
{code}

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.

{code}
var obj = { k: 1, v: 2}
JSON.stringify(obj)
{code}



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)



More information about the infinispan-issues mailing list