Using BizTalk 2013 R2 to transform an XML message element to a JSON array

Posted: September 25, 2015  |  Categories: BizTalk Uncategorized

I wanted to know whether the out of the box  JSON encoder pipeline component creates an JSON array  if there is only one repeating XML fragment. One of my colleagues found with BizTalk 2013 he had to add an array attribute to the XML to force the creation of a JSON array (https://connectedcircuits.wordpress.com/2014/03/27/sending-json-messages-from-a-biztalk2013-adaptor/).

I created a test schema shown below and deployed it to my run time.

image

I created this message and consumed it with a receive location that was configured with  passthrureceive location.

<ns0:Repeater xmlns:ns0=”http://JSONTest.Repeater”>
<Repeat>Repeat_0</Repeat>
</ns0:Repeater>

The XML message was then processed on a send port with a pipeline that only contained the JSON encoder pipeline component. Voila! I got the correct output shown below;

{
“Repeater”: {
“Repeat”: [
“Repeat_0”
]
}
}

Thanks Microsoft this has saved me a lot of extra work that i had to do in BizTalk 2013.

One Platform Operations, Monitoring and Analytics Software
BizTalk360

microsoft biztalk

Learn more

Over 500 customers across 30+ countries depend on BizTalk360

ServiceBus360

Azure service bus

Learn more

Start managing your Azure Service Bus namespaces in minutes

One Platform - Operations, Monitoring and Analytics Software
BizTalk360

microsoft biztalk

Learn more

Over 500 customers across 30+ countries depend on BizTalk360

One Platform - Operations, Monitoring and Analytics Software
ServiceBus360

Azure service bus

Learn more

Start managing your Azure Service Bus namespaces in minutes

Back to Top