Search code examples
mule-studiomule-componentanypoint-studiomule-esb

How to get XML to JSON transformer in MuleSoft AnyPoint Studio v7?


I am trying to create a web service sample where I am consuming a web service and I am getting output in XML format. I checked some tutorials and found that there is an inbuilt XML to JSON transformer in AnyPoint Studio v6 but I am not able to find the same in Mule 4 and AnyPoint Studio v7. Can anyone suggest what should I do? I don't want to use DataWeave currently.


Solution

  • If you're using Mule 4, you're going to have to use DataWeave sooner or later. They got rid of all the "x to y" transformers in Mule 4 because DataWeave supports these transformations.

    If your payload is in XML (or any other format, really) and you want to convert it to JSON, you can do this:

    %dw 2.0
    output application/json
    ---
    payload