Trying to process the response from WSO2 ESB and DDS API, which is currently in XML format. How can I convert this response to JSON format with some modifications using a script mediator?
<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelopexmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body>
<employeeCollection xmlns="http://employee.us.wso2.com">
<employee>
<EmployeeID>17</EmployeeID>
<FirstName>jak</FirstName>
<LastName>123</LastName>
<Team>ok</Team>
</employee>
<employee>
<EmployeeID>18</EmployeeID>
<FirstName>jak</FirstName>
<LastName>123</LastName>
<Team>ok</Team>
</employee>
<employee>
<EmployeeID>19</EmployeeID>
<FirstName>jak</FirstName>
<LastName>123</LastName>
<Team>ok</Team>
</employee>
</employeeCollection>
Desiring the output as shown below:
{ "status": "success",
"employee": [
{
"EmployeeID": 17,
"FirstName": "jak",
"LastName": 123,
"Team": "ok"
},
{
"EmployeeID": 18,
"FirstName": "jak",
"LastName": 123,
"Team": "ok"
},
{
"EmployeeID": 19,
"FirstName": "jak",
"LastName": 123,
"Team": "ok"
}]
}