I am trying to transform the result of an SOAP call to a set of POJO's -the following is an example of what my existing XML looks like and the transformation I am trying to apply.
<?xml version="1.0" encoding="UTF-8"?>
<orders>
<order>
<StoreID />
<Total>false</Total>
<IndividualEntry>
<Number>8</Number>
<DeliverCharge>30.0</DeliverCharge>
</IndividualEntry>
<IndividualEntry>
<Number>7</Number>
<DeliverCharge>20.0</DeliverCharge>
</IndividualEntry>
<IndividualEntry>
<Number>6</Number>
<DeliverCharge>1.0</DeliverCharge>
</IndividualEntry>
</order>
My Data Weave Transformation is as follows - as per the documentation you need to use a multi-key selector for repeated keys(in this case IndividualEntry) but how do I end up implementing that for this scenario ?
Orders: payload.orders.*order map {
StoreID : $.StoreID,
Total : $.Total,
IndividualEntry: {
Number: $.Number,
DeliverCharge: $.DeliverCharge
}
}
You can try like below
Orders: payload.orders.*order map {
StoreID : $.StoreID,
Total : $.Total,
IndividualEntry: $.*IndividualEntry map {
Number: $.Number,
DeliverCharge: $.DeliverCharge
}
}