在mule中连接两个数组

在mule中连接两个数组,mule,anypoint-studio,dataweave,Mule,Anypoint Studio,Dataweave,我正在尝试连接两个数组: arr1: [{"a":"value"}] arr2: [{"b":"value"}] expected result:[{{"a":"value"},{"b":"value"}}] vars.arr1 ++ vars.arr2 gives an error when arr1 is null. org.mule.runtime.core.api.expression.ExpressionRuntimeException: "You called the

我正在尝试连接两个数组:

arr1: [{"a":"value"}] 
arr2: [{"b":"value"}]
expected result:[{{"a":"value"},{"b":"value"}}]
vars.arr1 ++ vars.arr2  gives an error when arr1 is null. 

    org.mule.runtime.core.api.expression.ExpressionRuntimeException: "You called the function '+' with these arguments: 
      1: Null (null)
      2: Object 
我应该如何处理以下情况:

  • 当两个数组都为空时
  • 当其中一个数组为空时

  • 如果您不介意在两个输入数组都为null时获取空数组,请尝试以下操作:

    %dw 2.0
    output application/dw
    
    var arr1 = null
    var arr2 = null
    
    ---
    (arr1 default []) ++ (arr2 default [])