‘is not undefined’

The unary postfix operator ‘is undefined’ is used to check whether a value is missing or does not exist in JsonQL expressions. It returns a boolean result (true or false).

Note

This operator checks for missing values, invalid paths, and empty query results. To check specifically for JSON null values, use the ‘is null’ operator instead.

Operator Priority: 300

Operator Operands

  • Operand 1:
    • Type: any valid JsonQL expression (including invalid path).

    • Description: The value or expression to be checked for undefined status.

Evaluation Rules

The is undefined operator follows these evaluation rules:

  • Invalid paths: Returns true for paths that don’t exist in the JSON structure

  • Empty query results: Returns true when a query returns no results (e.g., First() with no matching items)

  • Valid values: Returns false for any existing value, including:

    • JSON null values

    • Numbers, strings, booleans

    • Objects and arrays

    • Empty collections

Important

The is undefined operator is distinct from is null:

  • is undefined checks if a value or path exists at all

  • is null checks if an existing value is explicitly set to JSON null

Use is undefined to verify that:

  • A JSON path is valid and exists

  • A query produced a result

  • A value is available for further processing

Examples

{
  "Comment_Operator_is_not_undefined_1": "(invalid.path is not undefined) evaluates to false.",
  "Operator_is_not_undefined_1": "$value(invalid.path is not undefined == false)",
  "Operator_is_not_undefined_2": "$value(NullValue is not undefined)",
  "Operator_is_not_undefined_3": "$value(Double1 is not undefined)",
  "Operator_is_not_undefined_5": "$value(Companies.Select(c => c.Employees).First() is not undefined)",
  "Operator_is_not_undefined_6": "$value(Companies.Select(c => c.Employees).First(e => e.Age > 200) is not undefined == false)"
}