Microsoft Teams Connector 12.11

# exists

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

## 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

Consider the following JSON:

    {
      "product": "IDOL",
      "component": "CFS",
      "version": { "major": 11, "minor": 3 },
      "ports": [
        { "type": "ACI", "number": 7000 },
        { "type": "Service", "number": 17000 }
      ]
    }

If this JSON is represented by a `LuaJsonValue` object named `myJsonValue`, you could use the `exists` method as follows:

    print (myJsonValue:exists("ports",0,"type"))
    -- true (LuaJsonArrays are zero-indexed)

    print (myJsonValue:exists("ports",2,"type"))
    -- false (LuaJsonArrays are zero-indexed, and there is no third value)

    print (myJsonValue:exists("version", "major"))
    -- true

## See Also

- existsByPath

© Copyright 2022 Micro Focus or one of its affiliates
Version 12.11 | Last updated February 2022

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 swpdl.idoldocsfeedback@microfocus.com.

We appreciate your feedback!

Product: IDOL Microsoft Teams Connector 12.11

Topic Title: exists