Truthy Values

DocuMotor uses ‘truthy values’ in various cases such as visibility of elements. The following values are not truthy for direct values.

  • null
  • ""
  • “false”
  • “null”
  • false
  • 0

In case the JSON path leads to an array, the array is not truthy if the array has 0 or ‘null’ elements.

Below are a few JSON examples where the truthy will evaluate false:

{
     "MyArray": [],
     "MyOtherArray": null,
     "MyInteger": 0,
     "MyOtherInteger": null,
     "MyBoolean": false,
     "MyOtherBoolean": null,
     "MyString": "",
     "MyOtherString": null,
     "MyDecimalNumber": 0,
     "MyOtherDecimalNumber": null
 }

And the same example, but where the truthy value will evaluate true:

{
     "MyArray": [
         1,
         2,
         3,
         4
     ],
     "MyOtherArray": [
         {
             "Fruits": "Apples",
             "Amount": 10
         },
         {
             "Fruits": "Bananas",
             "Amount": 5
         }
     ],
     "MyInteger": 10,
     "MyOtherInteger": -20,
     "MyBoolean": true,
     "MyOtherBoolean": true,
     "MyString": "Lorem ipsum",
     "MyOtherString": "Dolor sit amet \n Bacon Ipsum",
     "MyDecimalNumber": 1.0,
     "MyOtherDecimalNumber": 0.5
 }