This is my payload before transformation:
Payload: <stock article_id="28932" lot_number="282779"/>
This is the dataweave code to transform xml to json:
stockPayload: {
articleId: payload.stock_adjustment.@article_id,
lotNumber: payload.stock_adjustment.@lot_number,
uom: payload.stock_adjustment.@uom,
}
Now the uom is an optional field so it wouldn't be in xml attribute sometime. This transformation is currently throwing mapping error due to uom attribute not found.
How can I allow the dataweave to transform even attribute is not in xml?