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

> Lit une nested value depuis une table avec un dotted string path ou une 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`

  ## Arguments

  <ParamField path={"object"} type={"table"} required>
    Root table depuis laquelle lire. L'function exige que cet argument soit une table.
  </ParamField>

  <ParamField path={"path"} type={"string | table"} required>
    Path a suivre. Un string est split sur les dots; les integer string tokens sont lus avec raw array indexing. Une table path utilise ses array entries de 1 a #path comme keys.
  </ParamField>

  <ParamField path={"defaultValue"} type={"any"}>
    Fallback value renvoyee quand traversal atteint nil ou une non-table avant la fin du path.
  </ParamField>

  ## Retours

  <ResponseField name={"pathValue"} type={"any | nil"}>
    Value au requested path. Si le path manque, renvoie defaultValue quand il est fourni, sinon nil.
  </ResponseField>

  ## Exemple

  Lis une nested table value depuis un dotted string path ou une 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>
