Skip to Content
0
Former Member
May 01, 2016 at 12:25 PM

Strip tag name in JSON with REST adapter

1549 Views

Hello,

We have to post multiple address records from SAP to a 3rd party REST service.We are on PO 7.5.

We are using ABAP PROXY to PI to REST interface.

I have created data type with Address element with has 0-n occurrence. This has been assigned to message type MT_ADDRESS.

XML to JSON conversion on REST adapter has been used to convert input XML to JSON.

With this setting, below JSON is being sent to REST service.

{"Address":[

{"code":"POST1","name":"Test POS Address 1","erpId":"POST1","line1":"Address 1 Line 1","line2":"Address 1 Line 2","city":"City1","state":"MA","zip":19501,"country":"US","shipTo":true,"billTo":true,"invoiceTo":true},

{"code":"POST2","name":"Test POS Address 2","erpId":"POST2","line1":"Address 2 Line 1","line2":"Address 2 Line 2","city":"City2","state":"MA","zip":19502,"country":"US","shipTo":true,"billTo":true,"invoiceTo":true}

]}

Expected format :

[

{"code":"POST1","name":"Test POS Address 1","erpId":"POST1","line1":"Address 1 Line 1","line2":"Address 1 Line 2","city":"City1","state":"MA","zip":19501,"country":"US","shipTo":true,"billTo":true,"invoiceTo":true},

{"code":"POST2","name":"Test POS Address 2","erpId":"POST2","line1":"Address 2 Line 1","line2":"Address 2 Line 2","city":"City2","state":"MA","zip":19502,"country":"US","shipTo":true,"billTo":true,"invoiceTo":true}

]

My message type is MT_ADDRESS which has been stripped already due to setting "strip the outer element".

But I am not able find a way to strip the "Address" tag?

Please help?