azure api management – I want to convert xml to json using apim policies
Sample xml request :
<env:Body xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<ns5:CreateCustomerProfileRequest>
<ns5:SourceApplication>
<ns3:ApplicationID>HYBRIS_01</ns3:ApplicationID>
<ns3:ApplicationName>Hybris</ns3:ApplicationName>
</ns5:SourceApplication>
<ns5:CustomerProfile>
<ns5:CustomerIdentification>
<ns5:CustomerIDType>bill-to</ns5:CustomerIDType>
<ns5:CustomerID>618a18b3f33fa4007f2e76be</ns5:CustomerID>
<ns5:CustomerNumber/>
</ns5:CustomerIdentification>
<ns5:UserId>franlopue@icloud.com</ns5:UserId>
<ns5:CustomerType>Customer</ns5:CustomerType>
<ns5:CustomerAddressBook>
<ns3:Email>
<ns3:EmailAddress>franlopue@icloud.com</ns3:EmailAddress>
</ns3:Email>
</ns5:CustomerAddressBook>
<ns5:CustomerName>
<ns3:FirstName>Francisco</ns3:FirstName>
<ns3:LastName>Lopez-puente</ns3:LastName>
</ns5:CustomerName>
<ns5:CustomerSleep>35</ns5:CustomerSleep>
<ns5:ModifiedByName/>
<ns5:BillToInd>false</ns5:BillToInd>
<ns5:ShipToInd>false</ns5:ShipToInd>
</ns5:CustomerProfile>
</ns5:CreateCustomerProfileRequest>
</env:Body>
Json :
{"body": {
"ProcessName":"SC Account Registration Process",
"SiebelMessage": {
"IntObjectName": "SC EAI Contact",
"MessageType": "Integration Object",
"IntObjectFormat": "Siebel Hierarchical",
"ListOfSC EAI Contact": {
"Contact":
{
"Email Address": "test555@test.com",
"First Name": "SRI",
"Last Name": "TEST",
"SC External Customer Id":"1234aew",
"Integration Id":"1234aew",
"Type":"CRM_Unqualified",
"SC Sleep ":"35"
}}}}}
how to convert above xml to above json format using apim policies. please let me know what can we use to get the exact format of the code. Currently i want to use azure azure apim policies for this to do.
Read more here: Source link