How to keep square brackets when using REST JSON Plugin to parse and render one element JSON Array
book
Article ID: KB0083971
calendar_today
Updated On:
Products
Versions
TIBCO ActiveMatrix BusinessWorks Plug-in for REST and JSON
2.0.0
Description
Below is an example for a JSON Array. In the JSON Array "cars" there are three elements: ======== { "name":"John", "age":30, "cars":[ "Ford", "BMW", "Fiat" ] } ========
If we use the REST JSON plugin Parse JSON activity to parse the above JSON to XML and then use Render JSON activity to render the XML string, the output of Parse JSON activity is like the following:
How to keep square brackets when using REST JSON plugin to parse and render one element JSON Array.
Environment
Operation Systems: All
Resolution
This issue is due to the functionalities we use for XML to JSON conversion or vise versa and are based on generalized rules. The significance of JSON Array is to handle an element with occurrence more than 1 as a single occurrence already handled by JSON Object (simple name-value pair). The workaround for this is to add a "null" value in the JSON string after the first array element. In this case, the square brackets will be kept in the output.