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

> Serializuje Lua value do readable formatted JSON string przy uzyciu tej samej function co json.encodePretty.

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

  ## Argumenty

  <ParamField path={"value"} type={"any"} required>
    Value do encoded. nil, booleans, numbers, strings, tables i json.null sa obslugiwane bezposrednio. Unsupported Lua types sa encoded jako null, chyba ze errorOnUnsupported ma wartosc true.
  </ParamField>

  <ParamField path={"options"} type={"EncodeOptions"}>
    Optional encode options. json.pretty czyta te same options co json.encodePretty, a potem wymusza pretty na true. Bez options uzywa two-space indent. number ustawia indent width z clamp do 0.16, string ustawia indent text, a table moze ustawic sortKeys, emptyTableAsArray, errorOnUnsupported, encodeInvalidNumbersAsNull, maxDepth i indent.
  </ParamField>

  ## Zwroty

  <ResponseField name={"json"} type={"string"}>
    Readable formatted JSON string. Encoding errors sa rzucane jako Luau errors.
  </ResponseField>

  ## Typy

  ### EncodeOptions

  Kontroluje serializację i formatowanie JSON.

  | Name                         | Type      | Required | Opis                                                                            |
  | ---------------------------- | --------- | -------- | ------------------------------------------------------------------------------- |
  | `pretty`                     | `boolean` | No       | Włącza sformatowane, wielowierszowe wyjście JSON.                               |
  | `sortKeys`                   | `boolean` | No       | Sortuje klucze obiektów przed kodowaniem.                                       |
  | `emptyTableAsArray`          | `boolean` | No       | Koduje pustą tabelę jako tablicę zamiast obiektu.                               |
  | `errorOnUnsupported`         | `boolean` | No       | Zgłasza błąd zamiast zastępować nieobsługiwane wartości.                        |
  | `encodeInvalidNumbersAsNull` | `boolean` | No       | Koduje liczby NaN i nieskończone jako JSON null.                                |
  | `maxDepth`                   | `integer` | No       | Ustawia maksymalną głębokość zagnieżdżenia, zaciśniętą w zakresie od 1 do 4096. |
  | `indent`                     | `string`  | No       | Ustawia ciąg wcięcia ograniczony do 32 znaków.                                  |

  ## Przykład

  Encode JSON-compatible values jako readable formatted JSON przy uzyciu json.encodePretty alias.

  ```lua theme={null}
  local text = json.pretty({
      category = "JSON",
      tags = json.array({ "pretty", "alias" }),
      missing = json.null,
  }, {
      sortKeys = true,
  })

  print(text)
  ```
</div>
