AnsweredAssumed Answered

Transforming incoming JSON to multi row XML

Question asked by gouthamr388096 on Jun 26, 2018
Latest reply on Jun 26, 2018 by leif_jacobsen

Hi Folks

 

I have a requirement where incoming document(s) is JSON in the following format and I need to convert that into XML provided below. I am trying to map, but am not sure how I can achieve that.

[ {
"ActivityAssignmentID" : "a2T3F0000000ZOHUA2",
"ResourcedActivityID" : "a6k3F0000008wJVQAY",
"Assignment End Date" : "2018-05-25",
"Assignment Start Date" : "2018-04-02",
"Resource" : "#Generic - CEO (Company)",
"Element Name" : "WMP FP V2 Test (E000058-000003)",
"Element Reference" : "E000058-000003",
"Engagement Reference" : "E000058",
"Engagement Name" : "PTT - Jenna Smoke Test 5.23",
"Account Name" : "Pass the Test, Inc.",
"Action" : "Assignment Update"
}, {
"ActivityAssignmentID" : "a2T3F0000000ZebUAE",
"ResourcedActivityID" : "a6k3F0000008wJQQAY",
"Assignment End Date" : "2018-05-31",
"Assignment Start Date" : "2018-05-01",
"Resource" : "Robert Resource",
"Element Name" : "WMP Fixed Price with Plan (E000058-000002)",
"Element Reference" : "E000058-000002",
"Engagement Reference" : "E000058",
"Engagement Name" : "PTT - Jenna Smoke Test 5.23",
"Account Name" : "Pass the Test, Inc.",
"Action" : "Assignment Update"
}

]

 

I need to send this to destination system in this format

<list-item-batch xmlns="http://www.concursolutions.com/api/common/listitems/2010/02">
<list-item>
<name>#Generic - CEO (Company)</name> -- This is mapped from  Resource element from above
<level1code>a6k3F0000008wJQQAY</level1code> This is mapped from ResourcedActivityID element from above
<level2code></level2code>
<level3code></level3code>
<level4code></level4code>
</list-item>
<list-item>
<name>"PTT - Jenna Smoke Test 5.23</name> This is Engagement Name from above
<level1code>a6k3F0000008wJVQAY</level1code> This is mapped from ResourcedActivityID element from above
<level2code>E000058</level2code> This is mapped from Engagement Reference above
<level3code></level3code>
<level4code></level4code>
</list-item>
<list-item>
<name>WMP Fixed Price with Plan (E000058-000002)</name> This is mapped from Element Name from above
<level1code>a6k3F0000008wJVQAY</level1code> This is mapped from ResourcedActivityID element from above
<level2code>E000058</level2code> This is mapped from Engagement Reference above
<level3code>E000058-000002</level3code> This is mapped from Element Reference from above.
<level4code></level4code>
</list-item>
</list-item-batch>

Outcomes