cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Rest adapter - Array type

krishg
Active Participant
0 Kudos

We are using the XML-JSON conversion table to identify XML elements as Array.

Unfortunately, we have an element that appears as both Array and non-Array (under a different node). When we specify an element as Array, all occurances of that element is sent as an Array. Is there any way in conversion table to differentiate the element based on their parent node ?

0 Kudos

Hi Krish,

Did u resolve the above issue. If yes,please let me know how it was resolved.

Regards

Rizwana.

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi,

If Array Type is not maintained in Custom XML/JSON Conversion Rules and the XML element only occurs once, the XML element will be converted into a non-array-type. If Array Type is maintained in Custom XML/JSON Conversion Rules, the XML element should always result in a JSON array type even if the element occurs only once. If the XML element occurs more than once, it should result in a JSON array type. For more explanation, you can refer to:

SAP KBA 2743939 - XML Payload to JSON Conversion in REST receiver adapter

REST Adapter in PI/PO: Enhanced XML/JSON Conversion

Best regards,

Tina

Answers (2)

Answers (2)

0 Kudos

Hi,

If xml is well formatted then try converting it to Json with any third party tool.
Uncheck convert xml payload to json option in receiver channel or if synchronous scenario then in sender channel and deploy Custom_AF_Modules/FormatConversionBean module and check jsoncontent.
Regards,
Samir

0 Kudos

Hi,

share your xml structure if possible.

Regards,

Samir

krishg
Active Participant
0 Kudos

It is something like this, The occurance of 'A' at first level is array, while the occurance of 'A' with in parent node 'B' is not an array.

<xml header>

<A> </A>

<A> </A>

<B>

<A> </A>

</B>

</xml header>