
Hello All,
I am using batch aggregator to send payload data in small batches to another HTTP request, I am sending a JSON body, complete flow is working fine, but as soon as the payload enters the batch aggregator, it's form is altered and an extra space is added to each record in payload.
This is how my flow looks like;
This is how the actual payload looks like:
{
"first": "ABC",
"ln": "XYZ"
},
{
"first": "PUH",
"ln": "SDF"
}
I am printing the above sample in 'before aggregator' logger, but as soon as it enters the aggregator, I get this data, I am printing this in 'Inside aggregator' logger
Inside aggregator [org.mule.runtime.core.internal.streaming.bytes.ManagedCursorStreamProvider@33d18b01, org.mule.runtime.core.internal.streaming.bytes.ManagedCursorStreamProvider@51e80665]
Looks like a byte array, and when I try to change it to JSON in dataweave using below expression:
%dw 2.0
output application/json
---
payload
After this when I am trying to print payload, I get this:
"{\n \&# 34;first\&# 34;: \&# 34;ABC\&# 34;,\n \&# 34;ln\&# 34;: \&# 34;XYZ\&# 34;\n}",
"{\n \&# 34;first\&# 34;: \&# 34;PUH\&# 34;,\n \&# 34;ln\&# 34;: \&# 34;SDF\&# 34;\n}",
Can someone please help here? Not sure why aggregator is altering the payload data.
i had same issues after 4 years i.e. mime type getting altered, go to Aggregator flow, select checkbox called "Preserve Mime Types". This should work.