在 dataweave 中,我想将下面的复杂 xml 转换为 json 输出,如下所示:
<Message>
<Shipment>
<Containers>
<Container TrackingNo="Abc1" />
</Containers>
</Shipment>
<Shipment>
<Containers>
<Container TrackingNo="Abc2" />
<Container TrackingNo="Abc3" />
</Containers>
</Shipment>
<Shipment>
<Containers>
<Container TrackingNo="Abc4" />
<Container TrackingNo="Abc5" />
<Container TrackingNo="Abc6" />
</Containers>
</Shipment>
</Message>
在dataweave中转换后,我想获得以下JSON格式的输出:
tracking_no:[
{
TrackingNo="Abc1"
},
{
TrackingNo="Abc2"
},
{
TrackingNo="Abc3"
},
{
TrackingNo="Abc4"
},
{
TrackingNo="Abc5"
},
{
TrackingNo="Abc6"
}
]