When to use DataWeave
From our simple example, we’ve seen that DataWeave is a powerful addition to the Apex programming toolkit and allows us to perform manipulation quickly and easily. The DataWeave language is built for processing data and, as such, can be much more performant than Apex when it comes to certain data transformation requirements. For example, a presentation by some of the Salesforce team at Dreamforce 22 (https://www.slideshare.net/DanielBallinger3/dreamforce-22-unleash-powerful-data-transforms-in-apex-with-dataweave) found using a DataWeave script in Apex to process a 20,000 row 2.32 MB CSV file into a set of contacts to be more performant, consuming 35% less CPU time and 35% less heap usage.
This is not to say DataWeave should be seen as the single solution for data manipulation and transformation, particularly when working with data from integrations.
In short, it is my opinion that if you’re working with small data payloads from an API call...