> ## 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 التي يتم اتباعها. 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 مفقودة، يرجع 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>
