Hello,

from what I get so far, the parameters for a server-side javascript 
function can be simple things like strings and numbers.

My question is: is it possible to have a json object as the parameter?

For example, when calling the function 

function jsonparameterTest( par )
  if ( typeof par == 'object' ) {
return JSON.stringify( par );
  }
  else { 
    return "NO OBJECT: " + par;
  }
}

in the studio like this:

select jsonParameterTest( 'mystringparameter' ) FETCHPLAN *:1

It works as expected.

But when I try (and that's what I would like to do, if possible):
select jsonParameterTest( { "a": 1, "b": "zE" } ) FETCHPLAN *:1

I get:
com.orientechnologies.orient.core.command.script.OCommandScriptException: 
Error on parsing script at position #0: Error on execution of the script 
Script: jsonParameterTest ------^ --> javax.script.ScriptException: 
sun.org.mozilla.javascript.internal.EvaluatorException: Java class 
"[Ljava.lang.annotation.Annotation;" has no public instance field or method 
named "toJSON". (#93) in at line number 93 --> 
sun.org.mozilla.javascript.internal.EvaluatorException: Java class 
"[Ljava.lang.annotation.Annotation;" has no public instance field or method 
named "toJSON". (#93)

 So my question is:

   - can this be done, and 
   - if so, what am I doing wrong?
   

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to