Hi, That syntax is cool, please can you open a new issue to support it? In the meanwhile as workaround, with 1.7-SNAPSHOT you could do:
*select jsonParameterTest( $j ) LET $j = (select 1 as a, 'zE' as b) FETCHPLAN *:1 * Lvc@ Lvc@ On 6 May 2014 10:35, MrFT <[email protected]> wrote: > 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. > -- --- 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.
