Convert ByteArraySeekableStream back to JSON in Mule

4.6k views Asked by At

I have a flow that I have separated as part of it can be reused. I have added a flow reference in the existing flow to the new flow but am facing an issue with using the datatype that the payload is changed to when it enters the new flow.

The new flow consists of a for each loop that writes the payload to a database and the payload is changed to a ByteArraySeekableStream datatype when it enters the new flow which is not compatible with the for each loop.

What I need is to convert the ByteArraySeekableStream payload into a datatype that is compatible with the for each loop and then be able to convert the payload back to the original JSON datatype before it is written to the database.

How can I do this?

Currently the combinations I have tried have not worked and it has either failed at the for each loop or I have not been able to change the payload back to JSON

1

There are 1 answers

1
user3165854 On

I found that converting the ByteArraySeekableStream using the JSON to Object transformer and setting the return class to java.lang.Object fixed the problem.