cancel
Showing results for 
Search instead for 
Did you mean: 

Converting XML content to JSON

Former Member
0 Kudos

Hi Experts,

I have a scenario where I have to send a JSON message from PI to 3rd party system.

But the JSON message appears very different to me.

I am unaware how to fit this type JSON structure.

XML structure:

<?xml version="1.0" encoding="UTF-8"?>
<ns0:Payment_Order_SubmissionRequest xmlns:ns0="http://booking.com/Payments/Payoneer">
<mname>PerformPayoutPayment</mname>
<auth>
<p1>TEST</p1>
<p2>TEST1</p2>
</auth>
<PaymentDetails>
<p3>ABC</p3>
<p4>a1234</p4>
<p5>XYZ</p5>
<p6>a</p6>
<p7>234</p7>
<p8>TEST2</p8>
<p9/>
<p11>34</p11>
<Currency>EUR</Currency>
</PaymentDetails>
</ns0:Payment_Order_SubmissionRequest>

JASON Structure:

'mname=PerformPayoutPayment&p1=TEST&p2=TEST1&p3=ABC&p4=a1234&p5=XYZ&p6=a&p7=234&p8=TEST2&p11=34&Currency=EUR'

can anyone please help me!

Not sure if I can write JAVA mapping or can be adjusted in REST receiver adapter.

Best Regards,

Aarti

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member

Hello Aarti,

The XML structure in your question is not valid, so this is the first what you have to revise.

Regarding the XML -> JSON conversion, I strongly recommend to revise these blogs:

https://blogs.sap.com/2016/01/13/rest-adapter-in-sap-pipo-enhanced-xmljson-conversion/

https://blogs.sap.com/2015/03/18/jsontransformbean-part-2-converting-xml-to-json-content/

I believe these will be helpful.

Best regards,
Vadym

Former Member
0 Kudos

Hi Raghu,

Using POST method.

Regards,

Aarti

former_member186851
Active Contributor
0 Kudos

I think here XML values are appended in REST URL.Are you going to use get method?

Check if the below link helps

https://blogs.sap.com/2014/12/18/pi-rest-adapter-consuming-synchronous-restful-service/