# exists

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

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

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

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

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

## See Also

- existsByPath

_FT_HTML5_bannerTitle.htm