Products | Versions |
---|---|
TIBCO ActiveMatrix BusinessWorks Plug-in for REST and JSON | 2.0.0 |
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:
=======
<JSON>
<name>John</name>
<age>30</age>
<cars>Ford</cars>
<cars>BMW</cars>
</JSON>
=======
The output for Render JSON activity will be the same as the initial JSON string:
========
{
"name":"John",
"age":30,
"cars":[ "Ford", "BMW" ]
}
========
However, sometimes the customer's JSON array only contains one element. For example
========
{
"name":"John",
"age":30,
"cars":[ "Ford" ]
}
========
In this case the output of Parse JSON activity will be:
=======
<JSON>
<name>John</name>
<age>30</age>
<cars>Ford</cars>
</JSON>
=======
and the output of the Render JSON activity will be:
========
{
"name":"John",
"age":30,
"cars":"Ford"
}
========
You can see that the square brackets is missing.