Reputation: 716
I am trying to find out what is the payload type by printing it out using logger. I am aware that in Mule 3 you could use this #[payload.getClass().getSimpleName()]
or #[message.dataType.type]
.
How to achieve this in Mule 4? I did my google search but could not find any solution.
Upvotes: 2
Views: 10518
Reputation: 1172
Get payload media type: #[payload.^mediaType]
Reference: https://docs.mulesoft.com/dataweave/2.4/dataweave-cookbook-extract-data
Upvotes: 2
Reputation: 11606
You can use:
#[payload.^class]
Try logging:
#[payload.^]
Should print:
{class=java.util.ArrayList, encoding=UTF-8, mimeType=application/java, raw=[{}]}
But if your payload is not application/java mime/type but json or something instead it won't have class attribute.
Upvotes: 4