Created
February 10, 2022 19:17
-
-
Save emoran/055a8b509044c899d9fdcddbfe66ff41 to your computer and use it in GitHub Desktop.
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 | |
import try, fail from dw::Runtime | |
output application/java | |
fun isDate(value: Any): Boolean = try(() -> value as Date).success | |
fun getDate(value: Any): Date | Null | Any = ( if ( isDate(value) ) value | |
as Date as String else value ) | |
--- | |
(payload map (item,index) ->{ | |
(item mapObject ((value, key, index) -> { | |
(key):(getDate(value)) | |
} )) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment