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

> 使用 Real JSON string escaping rules 对 string 执行 escape，并返回 complete quoted JSON string literal。

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

  ## 参数

  <ParamField path={"text"} type={"string"} required>
    要 quote 的 string。function 使用 string type checking 读取这个 argument。
  </ParamField>

  ## 返回值

  <ResponseField name={"quoted"} type={"string"}>
    包含 opening 和 closing quote 的 complete JSON string literal。Quotes、backslashes、common control characters 和 bytes below 0x20 会被 escape。
  </ResponseField>

  ## 示例

  将 string convert 为 complete quoted JSON string literal。

  ```lua theme={null}
  local source = "Real Docs" .. string.char(10) .. [[Documentation "A"]]
  local quoted = json.quote(source)

  print(quoted)
  ```
</div>
