How to output JSON from "Execute Script"?

ZiggizagZiggizag Member Posts: 6 Learner I
I have a script producing a JSON output.

Unfortunately, this output seems to be "class java.lang.String" rather than "document", so it is not consumed by other operators.

The question is - how to properly return a "document" object containing e.g. following JSON:

{item_id: {$in: [36, 39]}}

This should be used as EVD (Read MongoDB) operator criteria input.

Can you help, please?



  • Options
    jwpfaujwpfau Employee, Member Posts: 296 RM Engineering

    you mean like this?

    <?xml version="1.0" encoding="UTF-8"?><process version="10.3.001">
      <operator activated="true" class="process" compatibility="10.3.001" expanded="true" name="Process">
        <parameter key="logverbosity" value="init"/>
        <parameter key="random_seed" value="2001"/>
        <parameter key="send_mail" value="never"/>
        <parameter key="notification_email" value=""/>
        <parameter key="process_duration_for_mail" value="30"/>
        <parameter key="encoding" value="SYSTEM"/>
        <process expanded="true">
          <operator activated="true" class="execute_script" compatibility="10.3.001" expanded="true" height="82" name="Execute Script" width="90" x="45" y="34">
            <parameter key="script" value="return new com.rapidminer.operator.text.Document(&quot;{item_id: {\$in: [36, 39]}}&quot;)"/>
            <parameter key="standard_imports" value="true"/>
          <connect from_op="Execute Script" from_port="output 1" to_port="result 1"/>
          <portSpacing port="source_input 1" spacing="0"/>
          <portSpacing port="sink_result 1" spacing="0"/>
          <portSpacing port="sink_result 2" spacing="0"/>

Sign In or Register to comment.