cancel
Showing results for 
Search instead for 
Did you mean: 

Formatting JSON in File to REST scenario

dani_amaya
Explorer
0 Kudos

Hello Experts,

Currently I'm working on a Sender File to REST Receiver scenario, where I read a text file to do the content conversion and then convert the XML message to JSON to be sent in a POST method.

From the receiver side it is expected to receive a payload body like this:

After the conversion and mapping I'm getting this JSON:

As you can see the JSON top level is not built with square brackets and the array has to begin with a name, I can't leave it empty, this leads me to get an error from the API side response cause it has a wrong format.

My Message type is defined as this:

The XML is always generated with an additional tag that has the name of the recordset structure defined in the FCC

I checked the following Receiver REST adapter options and added the XML/JSON conversion options, but I still didin't get the JSON as needed.

Is there any way to make the top level brackets to be of an array type and to remove the tag "Alarma" that is generated in the XML from the File Adapter recordset structure.

I appreciate your comments and help with this question and hope I make myself clear.

Thanks.

Danilo Amaya

Accepted Solutions (1)

Accepted Solutions (1)

manoj_khavatkopp
Active Contributor

Hi Danilo ,

  • To define element as an array type you can use enhanced xml/json conversion rule.
  • To remove element from the JSON you need to define module parameter : setIgnoredElements , SAP note :2465948.

Thanks,

Manoj

Answers (1)

Answers (1)

vicky20691
Active Contributor
0 Kudos

Hi Danilo,

The the sender JSON is valid depicting the equivalent XML without a Root Node is not possible.

it will look like
<root>

<refid>abc</refid>

</root>

Thus in your target side when you root element as Alarm it gets retained, dont see any workaround here.

1. Try unchecking the parameter Convert XML Name To JSon Name, & see the result.

2. Also try

Regards,

Vikas