Skip to Content

How does a SAP PO 7.5 rest adapter convert repeated XML segments to JSON array ?

Hello Experts,

Can any of you kindly explain how a rest adapter converts repeated segments in the xml to JSON array.

kindly find the JSON example attached. I want the xml to be converted like that.

What will be xml output at message mapping to convert like that.

Will there be any additional configuration that i have to do in the rest adapter for this ?

Is there any way to see the JSON output from rest adapter, other than using NWA logs or XPI inspectors ? i dont have access to both.jsonarray.txt

Thanks,

Nirmal

jsonarray.txt (731 B)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Jul 10, 2017 at 05:56 AM

    how to convert to json array using adapter configuration, check Vadim Klimov's blog

    https://blogs.sap.com/2016/01/13/rest-adapter-in-sap-pipo-enhanced-xmljson-conversion/

    if you want how will your xml output should look like, then convert your json into xml using below link.

    https://codebeautify.org/jsontoxml it will be something like below.

    root tag can be your message type name.

    <?xml version="1.0" encoding="UTF-8" ?>
    <root>
    	<otherCodes>
    		<avdCodeType>0</avdCodeType>
    		<codeNumber>CM2</codeNumber>
    	</otherCodes>
    	<otherCodes>
    		<avdCodeType>0</avdCodeType>
    		<codeNumber>D12</codeNumber>
    	</otherCodes>
    	<otherCodes>
    		<avdCodeType>0</avdCodeType>
    		<codeNumber>D51</codeNumber>
    	</otherCodes>
    	<otherCodes>
    		<avdCodeType>0</avdCodeType>
    		<codeNumber>E1N</codeNumber>
    	</otherCodes>
    	<otherCodes>
    		<avdCodeType>0</avdCodeType>
    		<codeNumber>ED5</codeNumber>
    	</otherCodes>
    	<otherCodes>
    		<avdCodeType>0</avdCodeType>
    		<codeNumber>EK1</codeNumber>
    	</otherCodes>
    	<otherCodes>
    		<avdCodeType>0</avdCodeType>
    		<codeNumber>EO1</codeNumber>
    	</otherCodes>
    	<otherCodes>
    		<avdCodeType>0</avdCodeType>
    		<codeNumber>EZ5</codeNumber>
    	</otherCodes>
    	<otherCodes>
    		<avdCodeType>0</avdCodeType>
    		<codeNumber>EZ7</codeNumber>
    	</otherCodes>
    </root>
    
    
    Add comment
    10|10000 characters needed characters exceeded