Open topic with navigation

# existsByPath

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

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

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

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

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

## See Also

- exists

© Copyright 2016-2019 Micro Focus or one of its affiliates | Send documentation feedback Close Send documentation feedback To open the configured email client on this computer, open an email window. Otherwise, copy the information below to a web mail client, and send this email to swpdl.idoldocsfeedback@microfocus.com. We appreciate your feedback! Product: Topic Title: Help Topic: Feedback:

_FT_HTML5_bannerTitle.htm