Stay organized with collections Save and categorize content based on your preferences.

See the supported connectors for Application Integration.

Merge two JSON arrays

Using the Data Mapping task, merge two JSON arrays, and store the resultant output in a new JSON variable.

Code sample

    "triggerConfigs": [{
      "label": "API Trigger",
      "startTasks": [{
        "taskId": "1"
      "properties": {
        "Trigger name": "test_string_case_conversion_API_1"
      "triggerType": "API",
      "triggerNumber": "1",
      "triggerId": "api_trigger/test_string_case_conversion_API_1"
    "taskConfigs": [{
      "task": "FieldMappingTask",
      "taskId": "1",
      "parameters": {
        "FieldMappingConfigTaskParameterKey": {
          "key": "FieldMappingConfigTaskParameterKey",
          "value": {
            "jsonValue": "{\n  \"@type\": \"\",\n  \"mappedFields\": [{\n    \"inputField\": {\n      \"fieldType\": \"JSON_VALUE\",\n      \"transformExpression\": {\n        \"initialValue\": {\n          \"referenceValue\": \"$inputJsonArray1$\"\n        },\n        \"transformationFunctions\": [{\n          \"functionType\": {\n            \"jsonFunction\": {\n              \"functionName\": \"MERGE\"\n            }\n          },\n          \"parameters\": [{\n            \"initialValue\": {\n              \"referenceValue\": \"$inputJsonArray2$\"\n            }\n          }]\n        }]\n      }\n    },\n    \"outputField\": {\n      \"referenceKey\": \"$outputJsonArray$\",\n      \"fieldType\": \"JSON_VALUE\",\n      \"cardinality\": \"OPTIONAL\"\n    }\n  }]\n}"
      "taskExecutionStrategy": "WHEN_ALL_SUCCEED",
      "displayName": "Data Mapping"
    "integrationParameters": [{
      "key": "outputJsonArray",
      "dataType": "JSON_VALUE",
      "displayName": "outputJsonArray"
    }, {
      "key": "inputJsonArray1",
      "dataType": "JSON_VALUE",
      "defaultValue": {
        "jsonValue": "[{\n  \"name\": \"Abhishek\",\n  \"course\": \"Mechanical\"\n}, {\n  \"name\": \"Chirag\",\n  \"course\": \"Civil\"\n}, {\n  \"name\": \"Sachin\",\n  \"course\": \"Medical\"\n}, {\n  \"name\": \"Vivek\",\n  \"course\": \"Software\"\n}]"
      "displayName": "inputJsonArray1",
      "jsonSchema": "{\n  \"$schema\": \"\",\n  \"type\": \"array\",\n  \"items\": {\n    \"type\": \"object\",\n    \"properties\": {\n      \"name\": {\n        \"type\": \"string\"\n      },\n      \"course\": {\n        \"type\": \"string\"\n      }\n    }\n  }\n}"
    }, {
      "key": "inputJsonArray2",
      "dataType": "JSON_VALUE",
      "defaultValue": {
        "jsonValue": "[{\n  \"name\": \"Shubham\",\n  \"course\": \"IT\"\n}, {\n  \"name\": \"Dravid\",\n  \"course\": \"Mechanical\"\n}]"
      "displayName": "inputJsonArray2",
      "jsonSchema": "{\n  \"$schema\": \"\",\n  \"type\": \"array\",\n  \"items\": {\n    \"type\": \"object\",\n    \"properties\": {\n      \"name\": {\n        \"type\": \"string\"\n      },\n      \"course\": {\n        \"type\": \"string\"\n      }\n    }\n  }\n}"
    "userLabel": "v1"

Upload and run the sample integration

To upload and run the sample integration, do the following steps:

  1. Save the integration sample as a .json file on your system.
  2. In the Google Cloud console, go to the Application Integration page.

    Go to Application Integration

  3. In the navigation menu, click Integrations. The Integrations List page appears.
  4. Select an existing integration or create a new integration by clicking Create integration.

    If you are creating a new integration:

    1. Enter a name and description in the Create Integration dialog.
    2. Select a Region for the integration from the list of supported regions.
    3. Click Create.

    This opens the integration in the integration designer.

  5. In the integration designer, click Upload/download menu and then select Upload integration.
  6. In the file browser dialog, select the file that you saved in step 1, and then click Open.

    A new version of the integration is created using the uploaded file.

  7. In the integration designer, click Test.
  8. Click Test integration. This runs the integration and displays the execution result in the Test Integration dialog.