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

> Lua value를 Real JSON encoder로 readable formatted JSON string으로 serializes합니다. json.pretty는 같은 function에 등록되어 있습니다.

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

  ## 인수

  <ParamField path={"value"} type={"any"} required>
    Encoded할 value입니다. nil, booleans, numbers, strings, tables, json.null은 직접 처리됩니다. Unsupported Lua types는 errorOnUnsupported가 true가 아니면 null로 encoded됩니다.
  </ParamField>

  <ParamField path={"options"} type={"EncodeOptions"}>
    Optional encode options입니다. json.encodePretty는 json.encode와 같은 options를 읽은 뒤 pretty를 true로 강제합니다. options가 없으면 two-space indent를 사용합니다. number는 0.16으로 clamp된 indent width를 설정하고, string은 indent text를 설정하며, table은 sortKeys, emptyTableAsArray, errorOnUnsupported, encodeInvalidNumbersAsNull, maxDepth, indent를 설정할 수 있습니다.
  </ParamField>

  ## 반환값

  <ResponseField name={"json"} type={"string"}>
    Readable formatted JSON string입니다. Encoding errors는 Luau errors로 throw됩니다.
  </ResponseField>

  ## 타입

  ### EncodeOptions

  JSON 직렬화 및 형식화를 제어합니다.

  | Name                         | Type      | Required | 설명                              |
  | ---------------------------- | --------- | -------- | ------------------------------- |
  | `pretty`                     | `boolean` | No       | 형식이 지정된 여러 줄 JSON 출력을 활성화합니다.   |
  | `sortKeys`                   | `boolean` | No       | 인코딩하기 전에 객체 키를 정렬합니다.           |
  | `emptyTableAsArray`          | `boolean` | No       | 빈 테이블을 개체 대신 배열로 인코딩합니다.        |
  | `errorOnUnsupported`         | `boolean` | No       | 지원되지 않는 값을 대체하는 대신 오류가 발생합니다.   |
  | `encodeInvalidNumbersAsNull` | `boolean` | No       | NaN 및 무한 숫자를 JSON null로 인코딩합니다. |
  | `maxDepth`                   | `integer` | No       | 1부터 4096까지 고정된 최대 중첩 깊이를 설정합니다. |
  | `indent`                     | `string`  | No       | 32자로 제한되는 들여쓰기 문자열을 설정합니다.      |

  ## 예제

  JSON-compatible values를 pretty output forced on 상태의 readable formatted JSON으로 encode합니다.

  ```lua theme={null}
  local text = json.encodePretty({
      name = "Real",
      version = 1,
      features = json.array({ "docs", "examples" }),
      missing = json.null,
  }, {
      sortKeys = true,
  })

  print(text)
  ```
</div>
