IBM Seedlist Connector 25.1
IBM Seedlist Connector Help

# exists

The `exists` method checks whether a specified path exists in the JSON array.

## Syntax

    exists( pathElements )

## Arguments

Argument | Description
--- | ---
`pathElements` | (json_path_string_or_integer) The path to check. Specify one or more path elements, which might be object attribute names (strings) or array indexes (integers).

## Returns

(Boolean) Returns `true` if the path exists, `false` otherwise.

## Example

    local myJsonObject = LuaJsonObject:new( { product="IDOL" , version=11 } )
    local myJsonArray = LuaJsonArray:new("zero", 1, 2, myJsonObject)

    print (myJsonArray:exists(0))
    -- true (LuaJsonArrays are zero-indexed)

    print (myJsonArray:exists(4))
    -- false (LuaJsonArrays are zero-indexed, and there is no fifth value)

    print (myJsonArray:exists(3, "product"))
    -- true

## See Also

- existsByPath

Copyright 2024 Open Text
Version 25.1 | Last updated January 2025

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: Knowledge Discovery IBM Seedlist Connector 25.1

Topic Title: exists