isBlank(text: String | Null): Boolean

Returns true if the given string is empty (""), completely composed of whitespaces, or null. Otherwise, the function returns false.


Name Description


An input string to evaluate.


This example indicates whether the given values are blank. It also uses the not and ! operators to check that a value is not blank. The ! operator is supported starting in Dataweave 2.2.0. Use ! only in Mule 4.2 and later versions.


%dw 2.0
output  application/json
var someString = "something"
var nullString = null
  // checking if the string is blank
  "emptyString" : isBlank(""),
  "stringWithSpaces" : isBlank("      "),
  "textString" : isBlank(someString),
  "somePayloadValue" : isBlank(payload.nonExistingValue),
  "nullString" : isBlank(nullString),

  // checking if the string is not blank
  "notEmptyTextString" : not isBlank(" 1234"),
  "notEmptyTextStringTwo" : ! isBlank("")


  "emptyString": true,
  "stringWithSpaces": true,
  "textString": false,
  "somePayloadValue": true,
  "nullString": true,
  "notEmptyTextString": true,
  "notEmptyTextStringTwo": false

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub
Submit your feedback!
Share your thoughts to help us build the best documentation experience for you!
Take our latest survey!