Nav

abs

abs(Number): Number

Returns the absolute value of a number.

Transform

        
     
1
2
3
4
5
6
7
8
9
%dw 2.0
output application/json
---
{
  a: abs(-2),
  b: abs(2.5),
  c: abs(-3.4),
  d: abs(3)
}
Output

        
     
1
2
3
4
5
6
{
  "a": 2,
  "b": 2.5,
  "c": 3.4,
  "d": 3
}