> ## Documentation Index
> Fetch the complete documentation index at: https://docs.projectreal.gg/llms.txt
> Use this file to discover all available pages before exploring further.

# json.getPath

> Читает nested value из table через dotted string path или array table of keys.

<div className="real-function-page">
  ```lua theme={null}
  json.getPath(object: table, path: string | table, defaultValue?: any): any | nil
  ```

  ## Алиасы

  * `json.getpath`

  ## Аргументы

  <ParamField path={"object"} type={"table"} required>
    Root table, из которой выполняется чтение. Function требует, чтобы этот argument был table.
  </ParamField>

  <ParamField path={"path"} type={"string | table"} required>
    Path для traversal. string split по dots; integer string tokens читаются через raw array indexing. table path использует array entries от 1 до #path как keys.
  </ParamField>

  <ParamField path={"defaultValue"} type={"any"}>
    Fallback value, возвращаемый, когда traversal достигает nil или non-table до завершения path.
  </ParamField>

  ## Возвраты

  <ResponseField name={"pathValue"} type={"any | nil"}>
    Value по requested path. Если path missing, возвращает defaultValue, когда он предоставлен, иначе nil.
  </ResponseField>

  ## Пример

  Читай nested table value через dotted string path или array table of keys.

  ```lua theme={null}
  local document = {
      user = {
          profile = { name = "Guest" },
          items = { "first", "second" },
      },
  }

  local name = json.getPath(document, { "user", "profile", "name" }, "Unknown")
  local second = json.getPath(document, "user.items.2")

  print(name)
  print(second)
  ```
</div>
