/
Generate an output Json field that is an array

Generate an output Json field that is an array

An output json field may be an array, such as: "customerCode": ["CustomerCode1"],

Current mapper does not support this output automatically. This is a guideline for work around in creating the desired output.

Instructions

  1. There are 2 ways to do the work around:

    1. Option1: def varArray0 = """["${var0}"]"""

      1. Uncheck Quote Value

      2. var0 is the input value, and varArray0 is the output value.

      3. We are “hardcoding” the brackets and quotes around the input value.

      4. This is acceptable if there is only 1 source/input value

      5. Screenshot:

    2. Option2:
      def varArray1 = []
      var1 = '"'+var1+'"'
      varArray1.add(var1.toString())

      1. Uncheck Quote Value

      2. var1 is the input value, and varArray1 is the output value

      3. We define varArray1 as an array/list

      4. We are “hardcoding” the quotes around the input value.

      5. This is useful if the input is a looping source field.

      6. Screenshot:

 

Related articles