%dw 2.0
import toBinary from dw::core::Numbers
output application/json
---
{
a: toBinary(-2),
b: toBinary(100000000000000000000000000000000000000000000000000000000000000),
c: toBinary(0),
d: toBinary(null),
e: toBinary(2),
}
toBinary
toBinary(Number): String
Transforms a decimal number into a binary number.
Introduced in DataWeave 2.2.0. Supported by Mule 4.2 and later.
Example
This example shows how the toBinary
behaves with different inputs.