cancel
Showing results for 
Search instead for 
Did you mean: 

SAP PI Advanced Json mapping problem

bokucansu
Explorer
0 Kudos

Hi,

I have a troubling problem on Json mapping and cant quite solve it out.

So the scenario is like this, request triggered from R3 via PROXY adapter and response is getting from REST adapter.

Here are the converted example of my request.

[ { "code": "A12345" },

{ "code":"B98765" }, ]

and get a response like this,

{ "data": {

"A12345": {

"firstname": "name",

"lastname": "surname" },

"B98765": {

"firstname": "name2",

"lastname": "surname2" } }, }

My response structure is connected to proxy and class structures must be solid. So i cant use its dynamic array names. For this purpose, i think this kind of response should do it;

{ "data": {

"item": {

"code": "A12345" ,

"firstname": "name",

"lastname": "surname" },

"item": {

"code": "B98765",

"firstname": "name2",

"lastname": "surname2" } }, }

So here is the question, how can i gather title name from array, change it's name to "item" and map title name on a element? And can it be done with REST conversion mapping rules?


Thanks in advance,

Accepted Solutions (0)

Answers (4)

Answers (4)

Ryan-Crosby
Active Contributor
0 Kudos

Hi Mustafa,

For me to see the response you have to comment on what I have posted. Aside from that I wasn't speaking of mapping the XML but only converting it to XML to see what is generated by the system. I can't help but notice that the codes are oddly systematic... A12345, B98765. Looking at those codes they look suspiciously rigged in some form of hack as opposed to anything sent from an application/system providing any form of usable context necessary for interoperability.

Regards,

Ryan Crosby

bokucansu
Explorer
0 Kudos

Any thoughts?

bokucansu
Explorer
0 Kudos

Hi Ryan,

I have already done the standart configuration part, However, A12345 and B98765 dynamic array response cannot converted to XML due to XML's static structure . I tried to json xml name mapping on REST configuration, and got some success from that, but for its work, i need to know A12345 and B98765 before hand which i dont know.

So i stuck 😞

Ryan-Crosby
Active Contributor
0 Kudos

Hi Mustafa,

I would start with converting the JSON response to XML within the REST configuration and then you can evaluate what will be necessary to get your scenario working.

Regards,

Ryan Crosby