Search code examples
snowflake-cloud-data-platformmatillion

merge two json statements into one using matillion ETL for snowflake


I want to combine these two JSON into one using matillion ETL for snowflake

JSON statement 1:

[{                                          
    "StepId": 1,
    "ParameterFileGroup": 1,
    "ParameterGroup": 1,
    "Parameter": 4,
    "Filter": "",
    "SortKey": "",
    "Skip": -1,                            
    "ParameterFileGroup": 1,
    "ParameterGroup": 1,

JSON statement 2:

{
        "ConditionId": 4,
        "Threshold": "37",
        "ActionPlan": 3,
        "TriggerAction": 5
}

the result I want:

[{                                          
    "StepId": 1,
    "ParameterFileGroup": 1,
    "ParameterGroup": 1,
    "Parameter": 4,
    "Filter": "",
    "SortKey": "",
    "Skip": -1,                            
    "ParameterFileGroup": 1,
    "ParameterGroup": 1,
{
        "ConditionId": 4,
        "Threshold": "37",
        "ActionPlan": 3,
        "TriggerAction": 5
}}
]

Solution

  • Assuming these are in 2 columns: JSON1, JSON2. Use the calculator component. add a new calculation called: JSON3. The calculation is: "JSON1" || '\r' || "JSON2" || '\r' || '}]'

    enter image description here