My Json Payload is
[
{
"Customer Contacted": "Rupesh",
"Inspected": "Mahesh",
"Lost": "Fire",
"Job Start Date": "",
"Work Complete": "",
"Billing Complete": ""
}
]
My XML is
%dw 2.0
output application/xml
---
{
root: {
CustomerContacted: if(payload."Customer Contacted"=="Rupesh") "Hari"
else null,
Inspected: if(payload."Inspected"=="Mahesh")"vamsi"
else null,
Lost: payload.Lost,
JobStartDate: payload."Job Start Date",
WorkComplete: payload."Work Complete",
BillingComplete: payload."Billing Complete"
}
}
If the values matches from Payload and value provided in If Condition then the value should be changed. After Transformation i am getting below Output.
<?xml version='1.0' encoding='UTF-8'?>
<root>
<CustomerContacted/>
<Inspected/>
<Lost>Fire</Lost>
<JobStartDate></JobStartDate>
<WorkComplete></WorkComplete>
<BillingComplete></BillingComplete>
</root>
I am getting null Values in Customer contacted and Inspected fields but i am expecting the values "Rupesh" and "Mahesh" as "Hari" and "Vamsi"
Kindly let me know what needs to be changed in the XML Code.