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

> Real JSON parser 로 JSON string 을 parse 하고 decoded arrays 와 objects 를 JSON helpers 용으로 표시한 decoded Lua value 를 반환합니다.

<div className="real-function-page">
  ```lua theme={null}
  json.decode(json: string, options?: DecodeOptions): any
  ```

  ## 인수

  <ParamField path={"json"} type={"string"} required>
    parse 할 JSON text 입니다. parser 는 optional surrounding whitespace 가 있는 하나의 JSON value 를 허용하고 invalid syntax 또는 trailing non-whitespace characters 가 있으면 throw 합니다.
  </ParamField>

  <ParamField path={"options"} type={"DecodeOptions"}>
    Optional decode options. boolean 은 useNull 을 직접 설정합니다. table 은 useNull 과 maxDepth 를 설정할 수 있습니다. maxDepth 는 1 에서 4096 으로 clamp 됩니다.
  </ParamField>

  ## 반환값

  <ResponseField name={"decoded"} type={"any"}>
    Decoded value. JSON objects 와 arrays 는 JSON type markers 가 있는 tables 가 됩니다. strings 는 Lua strings, numbers 는 Lua numbers, booleans 는 booleans 가 되며, null 은 useNull 이 false 가 아니면 json.null 이 됩니다.
  </ResponseField>

  ## 타입

  ### DecodeOptions

  JSON 구문 분석 동작을 제어합니다.

  | Name       | Type      | Required | 설명                                             |
  | ---------- | --------- | -------- | ---------------------------------------------- |
  | `useNull`  | `boolean` | No       | nil 대신 라이브러리의 null 센티널을 사용하여 JSON null을 나타냅니다. |
  | `maxDepth` | `integer` | No       | 1부터 4096까지 고정된 최대 중첩 깊이를 설정합니다.                |

  ## 예제

  JSON 을 Lua values 로 decode 하면서 JSON array, object, null markers 를 보존합니다.

  ```lua theme={null}
  local value = json.decode('{"name":"Real","tags":["docs"],"missing":null}')

  print(value.name)
  print(value.tags[1])
  print(json.type(value))
  print(json.isNull(value.missing))
  ```
</div>
