Microsoft Teams Connector 24.1

# existsByPath

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

## Syntax

    existsByPath( path )

## Arguments

Argument | Description
--- | ---
`path` | (string) The path to check. Construct the path from array indexes and object attribute names, and use a slash (`/`) as the separator. If an object attribute name includes a slash, then escape the slash with a backslash, for example `"one\\/two"`. Notice that you must also escape a backslash with another backslash.

## 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 an object named `myJsonObject`, you could use the `existsByPath` method as follows:

    print (myJsonObject:existsByPath("ports/0/type"))
    -- true (LuaJsonArrays are zero-indexed)

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

    print (myJsonObject:existsByPath("version/major"))
    -- true

## See Also

- exists

Copyright 2023 Open Text
Version 24.1 | Last updated December 2023

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: IDOL Microsoft Teams Connector 24.1

Topic Title: existsByPath