Created
March 27, 2024 15:35
-
-
Save shaneberry/416eba1d539a2a223d2ec1dafcd6b2ae to your computer and use it in GitHub Desktop.
Dataweave Example using map, flatMap, distinctBy & orderBy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%dw 2.0 | |
output application/json | |
--- | |
payload | |
map ((item, index) -> item.ErrorDetail.ValidationMessages) // Extract ValidationMessages from each item | |
flatMap ($) // Flatten the array of arrays into a single array | |
distinctBy ($.Message) // Remove duplicate messages based on the Message field | |
orderBy ($.Message default "") | |
map ($.Message) // Extract just the Message field |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment