JSON Array – Recap
I have shown previously that the JSON encoder pipeline component creates a JSON array when there is only one repeating XML fragment if the you create the solution correctly.
Mario Garcia wrote and said
Can you send me the complete code?, because I try but it does not work
JSON Array – Example
An example solution can be downloaded from here. Just unzip the project and import the deployment MSI from the deployment folder. Remember to run it too because this will create all the folders under C:\Temp. Enable the send and receive ports and restart the BizTalkApplication host instance. Rename the file C:\Temp\Repeater\Repeater.xml.txt to C:\Temp\Repeater\Repeater.xml. The resultant JSON file will be written to C:\Temp\RepeaterJSON\ as
{
“Repeater”: {
“Repeat”: [
“Repeat_0”
]
}
}
Most importantly the XML must conform to a schema that BizTalk knows about. Use a custom send pipeline that contains a XML Assembler pipeline component before the JSON encoder pipeline component.
If you don’t have a matching schema deployed and just have the JSON encoder pipeline component in the pipeline you will not get an array.
In summary the JSON encoder pipeline component creates a JSON array when there is only one repeating XML fragment if the you create the solution correctly.