/scripts/ahub.form.attachments.js
0

REST Sender adapter JSON Array for Request message

Apr 12, 2017 at 11:14 AM

113

avatar image

Dear All,

Does REST sender adapter can convert below JSON format where the "Driver" is an array.

JSON message as input to adapter:

{
"Driver": [{
"id": "A1",
"FirstName": "John",
"LastName": "Luis"
}, {
"id": "A2",
"FirstName": "Stefan",
"LastName": "Burd"
}
]
}

Expected XML message after conversion:

<?xml version="1.0" encoding="UTF-8"?>

xxxx.om:SAP_DriverMaster">
<Driver>
<FirstName>John</FirstName>
<LastName>Luis</LastName>
<id>A1</id>
</Driver>
<Driver>
<FirstName>Stefan</FirstName>
<LastName>Burd</LastName>
<id>A2</id>
</Driver>
</ns1:MT_Driver_C_Req>

I'm using "Add Wrapper Element" to add message type name (MT_Driver_C_Req) in the result XML. But I couldn't fixn any option to get the Driver array from Json in adpater. There is an option to have conversion rule but it seems that applies to response side of it.

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

1 Answer

Best Answer
avatar image
Former Member Apr 13, 2017 at 08:07 AM
0

Hi Abdulgaffar

Have a look in below blog.

https://blogs.sap.com/2014/12/18/pi-rest-adapter-blog-overview/

Regards,

Roshan

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Roshan,

Thank you for the reply. I already referred this blog but I couldn't make out the conversion trick for above scenario.

0
Skip to Content