The JSON Builder activity node

Infor Process Automation is compatible with the lightweight data-interchange format, JSON (Java Script Object Notation).

The JSON Builder node supplies a wizard to step you through building either a new JSON text or modifying an existing one.

JSON Builder fields

Field name Description
JSON Object The wrapper name for the JSON text as a whole. When a new JSON text is being built, this field is automatically populated as "NewJSONObject". This field is not mandatory. If the initial value is not altered, then no wrapper name will be given to the JSON text when it is built.
JSON Key

This field holds the key for the JSON text key value pair.

When a new JSON text is being built, this field is automatically populated as "(New Element 0)". If this initial value is not altered, it will not be used as the key in the text that is built.

A key can be any string except valid JavaScript key words.

Note: 

If you edit this field with your own value, then the next row will be auto-populated with the initial value "(New Element 0)".

Data Type

The Builder supports many data types. Select the data type you want to use from the dropdown box.

Options are:

  • String: Any string value can be used. This is the default data type if no data type is specified.

  • Number: Any numeric value. Non-numeric values will be converted to "0".

  • Boolean: True or false. Non-Boolean values will be converted as "false".

  • JSONObject: This data type can be used to build a complex, nested JSON text. It lets you work on one particular piece of the complex text.

    If this data type is selected, a new row is populated with the initial value under this key in the hierarchy format. Double-click the key to open a new wizard page with only the JSON text for this key.

  • JSONArray: An array of values can be assigned to a single key using this data type. Each value can be any supported data type including JSONArray or JSONObject. Multiple data types in a single array are also supported which means in a single array one value can be String and another can be Integer.

    When the JSONArray type is selected, a new row is populated with a default data type as String. You can change this to any data type and add a value. The key field is non-editable.

  • JSONFragment: This data type can be used if a JSON text needs to be passed during runtime through a variable. This data type can be used only for variables. Hard-coded values cannot be used.

    This special data type is only for use with IPA JSON Builder; it is not a common JSON data type.

  • Null: If null must be passed for a key, use this data type. (The Value field is non-editable for this data type.)

  • Value: Values can be input in this field based on the data type selected.

    Variables can be used. Press Ctrl+[space] to view the list.

    This field is non-editable for JSONObject and JSONArray data types. This is because a new row is created for these data types to select values.

Available buttons

The following table describes the use of buttons that are activated for the JSON Builder node.

Button What it does
Delete Deletes one or more key and value pairs. Any key can be selected to delete and Ctrl or Shift can be used to select multiple keys. Keys from different JSONObject or JSONArray also can be selected if the JSON text is nested.
Delete All Deletes all key and value pairs in the JSON text. If you select this button, the entire JSON text in the Builder is deleted.
Expand Expands one or more JSONObjects or JSONArrays including any child objects or arrays if they exist.
Expand All Expands all JSONObjects and JSONArrays in the entire JSON text.
Collapse Collapses one or more JSONObjects or JSONArrays including any child objects or arrays if they exist.
Collapse All Collapses all the JSONObjects and JSONArrays in the Builder.
Move Up Moves up the key and value pair in the order.
Move Down Moves down the key and value pair in the order.
Insert Below Insert a new row with an initial value lower than the selected key.
Insert Above Insert a new row with an initial value higher than the selected key.
Copy

Copies the data type and value of the selected key.

This features copies all JSONObject or JSONArray values including any objects or arrays if they exist.

This feature might be helpful, for example, in a situation where the same JSONObjects are built with the same keys but different values.

Paste Pastes the data type and value (copied with the Copy button) into the selected key. If the key has an existing data type and value, it will be replaced with the new data type and value.
Undo Undoes the previous work only.

Output variables

At runtime this activity node creates:

  • <nodename>_jsonVar: A JSON Object variable

  • <nodename>_jsonText: A text variable

These variables can be used anywhere in the process.