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

> Parsuje JSON string przy uzyciu Real JSON parser i zwraca decoded Lua value, oznaczajac decoded arrays i objects dla JSON helpers.

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

  ## Argumenty

  <ParamField path={"json"} type={"string"} required>
    JSON text do parsowania. parser akceptuje jedna JSON value z optional surrounding whitespace i rzuca blad przy invalid syntax albo trailing non-whitespace characters.
  </ParamField>

  <ParamField path={"options"} type={"DecodeOptions"}>
    Optional decode options. boolean ustawia useNull bezposrednio. table moze ustawic useNull i maxDepth; maxDepth jest clamp od 1 do 4096.
  </ParamField>

  ## Zwroty

  <ResponseField name={"decoded"} type={"any"}>
    Decoded value. JSON objects i arrays staja sie tables z JSON type markers, strings staja sie Lua strings, numbers staja sie Lua numbers, booleans staja sie booleans, a null staje sie json.null, chyba ze useNull jest false.
  </ResponseField>

  ## Typy

  ### DecodeOptions

  Kontroluje zachowanie analizy JSON.

  | Name       | Type      | Required | Opis                                                                            |
  | ---------- | --------- | -------- | ------------------------------------------------------------------------------- |
  | `useNull`  | `boolean` | No       | Reprezentuje JSON null ze wskaźnikiem null biblioteki zamiast nil.              |
  | `maxDepth` | `integer` | No       | Ustawia maksymalną głębokość zagnieżdżenia, zaciśniętą w zakresie od 1 do 4096. |

  ## Przykład

  Decode JSON do Lua values z zachowaniem JSON array, object i 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>
