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

> Escapes a string using Real's JSON string escaping rules and returns the escaped content without surrounding quotes.

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

  ## Arguments

  <ParamField path={"text"} type={"string"} required>
    String to escape. The function reads this argument with string type checking.
  </ParamField>

  ## Returns

  <ResponseField name={"escaped"} type={"string"}>
    Escaped JSON string content without the opening and closing quote. Quotes, backslashes, common control characters, and bytes below 0x20 are escaped.
  </ResponseField>

  ## Example

  Escape a string for the inside of a JSON string without adding the surrounding quotes.

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

  print(escaped)
  ```
</div>
