Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3184

Adapter module or Java mapping to convert object into an array in JSON output

$
0
0

Hi

 

I am on single stack SAP PO. Mine is a REST to RFC synchronous call. I am using Java mapping to convert the xml to JSON. The ECC system is sending a URL in the response message. If I use the conversion of REST adapter, the forward slashes in the URL are escaped with a backward slash.

So I have to use Java mapping.

 

Because of that, I cannot use the SAP's method to convert xml into JSON.

 

In my target payload, there is a node called "Item".

 

"Items" :    [

          {

"Quantity": 1,

"UnitOfMeasure": "EA",

"MaterialDescription": "ABCD"

          }

          {

"Quantity": 2,

"UnitOfMeasure": "FR",

"MaterialDescription": "FGHI"

          }

               ]

 

This appears an array!

 

If there is only one set of values, then Items appear as object

 

 

                                                                        

 

"Items" :    {

          {

"Quantity": 1,

"UnitOfMeasure": "EA",

"MaterialDescription": "ABCD"

          }

               }

 

I want the node "Items" to appear as array always. If it is an array then let it be array, and if it is an object it should be an array.

 

Is there a way to achieve this using existing Adapter module or through a Java Mapping?

 

Regards

 

Harish Babu


Viewing all articles
Browse latest Browse all 3184

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>