可变索引值映射Dataweave

时间:2018-11-29 20:13:17

标签: dataweave

这是我必须映射以下项目的输入有效载荷

{
    "externalOrderLineRefs": [
        {
            "sourceSystem": "Shutterfly",
            "identifier": "SFLYOrderLine09876"
        }
    ],
    "externalQuoteLineRefs": [
        {
            "sourceSystem": "Salesforce",
            "identifier": "SFDCQuoteLine123"
        },
        {
            "sourceSystem": "Shutterfly",
            "identifier": "SFLYQuote123456"
        }
    ]
}

映射条件: Quote = externalQuoteLineRefs.identifier WHERE sourceSystem =“ Shutterfly”

1 个答案:

答案 0 :(得分:3)

这会成功吗?否则,精确的输出将非常有益。

%dw 1.0
%output application/json
---
payload.externalQuoteLineRefs filter $.sourceSystem == "Shutterfly" map {
    quote: $.identifier
}

输出:

[
  {
    "quote": "SFLYQuote123456"
  }
]