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

> Lee un nested value desde una table usando un dotted string path o una 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`

  ## Argumentos

  <ParamField path={"object"} type={"table"} required>
    Root table desde la que se lee. La function requiere que este argument sea una table.
  </ParamField>

  <ParamField path={"path"} type={"string | table"} required>
    Path a seguir. Un string se divide por dots; integer string tokens se leen con raw array indexing. Una table path usa sus array entries desde 1 hasta #path como keys.
  </ParamField>

  <ParamField path={"defaultValue"} type={"any"}>
    Fallback value devuelto cuando traversal llega a nil o a non-table antes de completar el path.
  </ParamField>

  ## Retornos

  <ResponseField name={"pathValue"} type={"any | nil"}>
    Value en el requested path. Si falta el path, devuelve defaultValue cuando fue proporcionado, si no nil.
  </ResponseField>

  ## Ejemplo

  Lee un nested table value desde un dotted string path o una 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>
