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

> Escapes a string using Real's JSON string escaping rules and returns a complete quoted JSON string literal.

Escapes a string using Real's JSON string escaping rules and returns a complete quoted JSON string literal.

## Syntax

```lua theme={null}
json.quote(text: string): string
```

## Arguments

| Name   | Type     | Required | Description                                                                  |
| ------ | -------- | -------- | ---------------------------------------------------------------------------- |
| `text` | `string` | Yes      | String to quote. The function reads this argument with string type checking. |

## Returns

| Name     | Type     | Description                                                                                                                                             |
| -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `quoted` | `string` | Complete JSON string literal including the opening and closing quote. Quotes, backslashes, common control characters, and bytes below 0x20 are escaped. |

## Example

Convert a string into a complete quoted JSON string literal.

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

print(quoted)
```
