Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
%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