2

How to convert xml payload to a string in dataweave 2.0?

Thanks Vempati

2 Answers2

4

The best way would be something like.

output application/java
---
payload.^raw as String

The .^raw returns the underlying input stream then we transform it into a String and return it as a Java Value so the payload is a java.lang.String

machaval
  • 4,969
  • 14
  • 20
1

https://docs.mulesoft.com/mule-runtime/4.1/dw-core-functions-write

write(payload, "text/plain", {"encoding": "UTF-8"})
utechtzs
  • 1,013
  • 5
  • 12