%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: Number): String
Transforms a decimal number into a binary number.
Introduced in DataWeave version 2.2.0.
Example
This example shows how the toBinary
behaves with different inputs.