Skip to Content
avatar image
Former Member

REST Adapter: Problem converting JSON containing empty arrays

1) . We have a REST to REST Scenario, when the response is empty like below.

{ "main":

{ "row": [] }

}

2). The XML conversion is taking out 'row' tag and formed as below:

<Wrapper>

<main></main>

</Wrapper>

3). I have tried to add the 'row' tag in the message mapping and converting again the XML to JSON in the sender channel but the converted JSON Output is as follows

{ "main":

{ "row": [""] }

}

How to get rid of the extra "" (double quotes) with in the [ ] -->{ "row": [""] }

Same issue was mentioned in the below thread, however there is no solution at the end.

https://archive.sap.com/discussions/thread/3894034

Please see if you can help in any way ?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Jan 09 at 11:17 AM

    In the conversion rules of the channel for Rest, you can define arrayType = true for the field 'row'

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 29 at 01:34 PM

    Hello,

    was this issue resolved ??

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 29 at 02:40 PM

    Hello,

    Just for reference was able to solve this issue after following this SAP Note :

    2505988 - Remove leading empty element in JSON Array after XML to JSON conversion

    Thanks.

    Add comment
    10|10000 characters needed characters exceeded