Working with Process Objects

Version 1

    Often times, there is a need to generate JSON response with array elements, coming as part of SOAP response

     

     

    To accomplish this requirement, you can create a Process Object named po-Rate with a field named "Rate" of type Object List with reference to "Any". The process has a service call step to make SOAP request and using the response, we can populate the po-Rate process object.

     

    Process will return JSON response with double quotes.

     

    {

    "Rate":[

                   "75.65",

                   "60.60"

                ]

    }

     

    We do not want double quotes in the response. How can we accomplish this?

     

    If there was a option to define field "Rate" of type Object List with reference to "Number" datatype, then double quotes could have been avoided. But ICRT does not have this option.

     

    Here is the xquery expression that would have been to populate the Rate field.

     

    for $temp_rate in $something

          return(

          <Rate>{$temp_rate/Price/text()}</Rate>

          )

     

    And also if there is only one item added to process object list, ICRT is not including "[" in the response.

     

    {

    "Rate": "75.65"

    }

     

    Solution:

    You can try to create a Process Object with one field (Design home > new > Process Object) with data type as integer and create a output variable of type process object.

     

    Below screenshots will help understand the same:

     

     

    for second query:

     

    Use the below sample Xquery to let ICRT know that its of type array and not primitive type:

     

    <root xmlns:m="urn:informatica:ae:xquery:json2xml:meta-data">

    <a m:isArray="true">1</a>

    <b>3</b>

    </root>