I have a array with multiple elements in it :
var arrayData = [
customerId: "123", mobileNumber: "999"},
customerId: "122", mobileNumber: "998"},
customerId: "121", mobileNumber: "997"}
];
I need this to convert into XML like below:
<Result>
<customerId>123</customerId>
<mobileNumber1>999</mobileNumber>
<customerId>122</customerId>
<mobileNumber1>998</mobileNumber>
<customerId>121</customerId>
<mobileNumber1>997</mobileNumber>
</Result>
I've tried the following:
arrayData.map(obj => `<Result><customerId>${obj.customerId}</customerId><mobileNumber>${obj.mobileNumber}</mobileNumber></Result>`).join('');
but I'm getting unavailable in placeholders , any idea how to achieve this ?