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

> Real JSON string escaping rules を使って string を escape し、surrounding quotes なしの escaped content を返します。

<div className="real-function-page">
  ```lua theme={null}
  json.escape(text: string): string
  ```

  ## 引数

  <ParamField path={"text"} type={"string"} required>
    Escape する string。function はこの argument を string type checking で読みます。
  </ParamField>

  ## 戻り値

  <ResponseField name={"escaped"} type={"string"}>
    Opening と closing quote なしの escaped JSON string content。Quotes、backslashes、common control characters、bytes below 0x20 は escape されます。
  </ResponseField>

  ## 例

  Surrounding quotes を追加せず、JSON string の内側用に string を escape します。

  ```lua theme={null}
  local source = "line 1" .. string.char(10) .. [[line "2"]]
  local escaped = json.escape(source)

  print(escaped)
  ```
</div>
