1

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.

Tomeister
  • 675
  • 2
  • 9
  • 26

2 Answers2

3

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.

Ryan Carter
  • 11,441
  • 2
  • 20
  • 27
2

Get payload media type: #[payload.^mediaType]

Reference: https://docs.mulesoft.com/dataweave/2.4/dataweave-cookbook-extract-data

Community
  • 1
  • 1
zdenekca
  • 1,174
  • 8
  • 8