Skip to Content
0
Jan 29, 2021 at 09:37 AM

Custom XML/JSON Conversion Rules . Array Type definition

56 Views

Hi all,

I have a JDBC to Rest scenario.

In JSON I have defined an element as an array, but sometimes it contains only one item, so in this case it's not created as an array. However, REST API needs only an array for this element.

I know that there's table “Custom XML/JSON Conversion Rules” (I referred to https://blogs.sap.com/2016/01/13/rest-adapter-in-sap-pipo-enhanced-xmljson-conversion/) with Array Type = true, but I don't know how to set column Name.

This is my xml

 <customFields>
      <id>11</id>
      <value>00</value>
   </customFields>
   <customFields>
      <id>123</id>
      <value>abc</value>
   </customFields>
   <customFields>
      <id>456</id>
      <value>
         <id>455</id>
         <select>true</select>
      </value>
   </customFields>
   <customFields>
      <id>789</id>
      <value>def</value>
   </customFields>

fields under element value must be set as an array:

<value>

<id>455</id>

<select>true</select>

</value>

but if I set "value" in column Name of conversion table, it will transform also

<customFields>

<id>123</id>

<value>abc</value>

</customFields>

Do you know how I can set Name column to specify that element value is that one?

Thank you.

Regards,

Nicola Bacchion