Question

based on the known xml2json conversion rules :

1 - An XML element without text node

<a></a> --> {"a":""}

2 - An empty XML element1

<a/> --> {"a":null}

I expect to have different conversion from the Worklight xml parser.

Instead it seems that both scenarios are converted to empty string, never using the null value (or the empty square brackets at least).

Is this a work-as-designed approach, a limitation or a configurable behaviour?

Was it helpful?

Solution

The behavior is configurable. You did not mention it, but I assume you are talking about XML-to-JSON conversion in Worklight adapters. When you generate a Worklight adapter, a filtered.xsl file is generated. You can and should use that .xsl file to affect the conversion.

See Overview of IBM Worklight adapters documentation and this SO question.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top