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

> Doc nested value tu table bang dotted string path hoac array table of keys.

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

  ## Alias

  * `json.getpath`

  ## Đối số

  <ParamField path={"object"} type={"table"} required>
    Root table de doc tu do. Function yeu cau argument nay la table.
  </ParamField>

  <ParamField path={"path"} type={"string | table"} required>
    Path can di theo. string duoc split theo dots; integer string tokens duoc doc bang raw array indexing. table path dung array entries tu 1 den #path lam keys.
  </ParamField>

  <ParamField path={"defaultValue"} type={"any"}>
    Fallback value tra ve khi traversal gap nil hoac non-table truoc khi hoan tat path.
  </ParamField>

  ## Giá trị trả về

  <ResponseField name={"pathValue"} type={"any | nil"}>
    Value tai requested path. Neu path missing, tra ve defaultValue khi duoc cung cap, neu khong thi nil.
  </ResponseField>

  ## Ví dụ

  Doc nested table value tu dotted string path hoac 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>
