Iterate over JSON payload with WSO2 Enterprise Integrator

Arunan Sugunakumar
Think Integration
Published in
2 min readMay 30, 2019

--

JSON is a common format to send data payloads nowadays. And a lot of tools are providing first hand support to JSON payloads. Web services on the other hand, extensively use XML as their default format. WSO2 Enterprise Integrator (an open source integration solution) uses XML in their Synapse Engine. So far, WSO2 EI was able to provide support for JSON payload in their mediators by converting the JSON to XML. This solution is possible for most of the use cases, but there are some instances where this solution is not sufficient.

Currently, native JSON support exists in most of the highly used mediators, and this blog talks about the introduction of native JSON support in the Iterate mediator, which is used to split the message into a number of different messages derived from the parent message.

Iterate mediator adheres with the Scatter Gather pattern of Enterprise Integration Patterns. When you have an array of elements as a payload and the backend accepts only a single element at a time, you can use Iterate mediator to iterate over individual elements. You can use aggregate mediator to aggregate the individual responses and send as one back to the client.

Iterate mediator updated syntax in EI 6.5.0

Following is a sample configuration in which you can test the native JSON support.

The input payload :

The above payload gets divided into three separate payload and sent to the backend.

This feature is available from Enterprise Integrator 6.5.0 which you can download from here. You can also experience the new Integration Studio to create the Synapse configurations and deploy it in WSO2 EI or deploy it in the new Micro Integrator and run it on the cloud.

--

--

Arunan Sugunakumar
Think Integration

Software Engineer (Integration) @wso2, Graduated from University of Moratuwa (Computer Science & Eng) and GSOCer @intermineorg