0
votes

Using postman, I am posting a JSON message to mule, the HTTP receiver inside mule flow is returning the payload org.glassfish.grizzly.utils.BufferInputStream@ format..

I tried to convert the payload into JSON using "Byte Array to Object" and then "Object to JSON", but I get the payload with lot of new line character

{\n \"Name\": \"John\",\n \"Code\": \"003\"\n}\n \n \t\n "

when I tried to extract the fields Name and code, receiving null

I am expecting the payload as

{ "Name": "John", "Code": "003"

}

Is there something I am missing in the flow?

This must be a common problem, what is the standard way to receive JSON message inside mule flow?

Thank you

1
It ideally works the way you are doing.You can optionally use "Transform Message" to get customized output.Kindly paste your code so we can help you precisely.Mahesh_Loya
use Object to string instead of "Byte Array to Object"Anirban Sen Chowdhary
problem solve. Used transform <dw:transform-message doc:name="transformMessage"> <dw:set-payload><![CDATA[%dw 1.0 %output application/java --- payload]]></dw:set-payload> </dw:transform-message>, now I can access the fields using #[payload.field],jaya k
org.glassfish.grizzly.utils.BufferInputStream is not a format but the underlying representation of the data. If the POSTMAN request features a JSON Content-Type header then you should be able to access fields using the transform component.afelisatti

1 Answers

0
votes

problem solve. Used transform

%output application/java

payload]]> , now I can access the fields using #[payload.field],