Skip to Content
0

Converting XML content to JSON

Aug 10, 2017 at 01:59 PM

57

avatar image
Former Member

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"?>
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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

avatar image
Former Member
Aug 10, 2017 at 03:07 PM
1

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

Share
10 |10000 characters needed characters left characters exceeded
Raghuraman S Aug 10, 2017 at 02:23 PM
0

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/

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Aug 10, 2017 at 02:36 PM
0

Hi Raghu,

Using POST method.

Regards,

Aarti

Share
10 |10000 characters needed characters left characters exceeded