Skip to content

$boolean(arg) when arg is no-match #433

@andrwo

Description

@andrwo

Just a query. I wanted something that returns "true" if a arg path evaluates to truthy, and "false" if falsey or not found (no match).

data:

{
  "_formValues": {
    "test": true
  }
}

Jsonata expressiosn:

$not(_formValues.test) returns false
$not(_formValues.test2) returns true

But:

$boolean(_formValues.test) returns true
$boolean(_formValues.test2) returns *no match*

I found it a bit inconsistent that a $boolean(arg) can return *no match*. Should it be returning false instead when hit against a no match? Or perhaps someone can explain why this is perfectly good and logical :)

Using: Jsonata 1.8.2 (as in the exerciser)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions