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

> Dotted string path 또는 array table of keys를 사용해 table에서 nested value를 읽습니다.

<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은 dots로 split됩니다. integer string tokens는 raw array indexing으로 읽습니다. table path는 1부터 #path까지의 array entries를 keys로 사용합니다.
  </ParamField>

  <ParamField path={"defaultValue"} type={"any"}>
    Traversal이 path 완료 전에 nil 또는 non-table에 도달하면 반환되는 fallback value입니다.
  </ParamField>

  ## 반환값

  <ResponseField name={"pathValue"} type={"any | nil"}>
    Requested path의 value입니다. path가 missing이면 제공된 경우 defaultValue를 반환하고, 아니면 nil을 반환합니다.
  </ResponseField>

  ## 예제

  Dotted string path 또는 array table of keys에서 nested table value를 읽습니다.

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