Nav

isEmpty

isEmpty(Array<Any>): Boolean

Returns true or false depending on whether an array is empty.

Transform

        
     
1
2
3
4
5
6
7
%dw 2.0
output application/json
---
{
  empty: isEmpty([]),
  nonEmpty: isEmpty([1])
}
Output

        
     
1
2
3
4
  {
    "empty": true,
    "nonEmpty": false
  }
isEmpty(String): Boolean

Returns true or false depending on whether a string is empty.

Transform

        
     
1
2
3
4
5
6
7
%dw 2.0
output application/json
---
{
  empty: isEmpty(""),
  nonEmpty: isEmpty("DataWeave")
}
Output

        
     
1
2
3
4
  {
    "empty": true,
    "nonEmpty": false
  }
isEmpty(Object): Boolean

Returns true or false depending on whether an object is empty.

Transform

        
     
1
2
3
4
5
6
7
%dw 2.0
output application/json
---
{
  empty: isEmpty({}),
  nonEmpty: isEmpty({name: "DataWeave"})
}
Output

        
     
1
2
3
4
  {
    "empty": true,
    "nonEmpty": false
  }