%dw 2.0
import * from dw::util::Coercions
output application/json
---
{
a: toBoolean("true"),
b: toBoolean("false"),
c: toBoolean("FALSE"),
d: toBoolean("TrUe")
}
DataWeave
toBoolean
toBoolean(str: String): Boolean
Transform a String
value into a Boolean
value.
Introduced in DataWeave version 2.4.0.
Parameters
Name | Description |
---|---|
|
The |
Example
This example shows how toBoolean
behaves with different inputs.
Source
Output
{
"a": true,
"b": false,
"c": false,
"d": true
}
Json