json. quote Synchronous
Produce one complete JSON string token from text. It is handy when you need a quoted value for a small constructed fragment; use json.encode for a whole table or document.
Luau
json.quote(text: string) -> stringParameters
| Parameter | Type | Description |
|---|---|---|
text | string | Raw text to quote and escape. |
Returns
stringEscaped text enclosed in double quotation marks.
Example
Luau
local token = json.quote('say "hello"')
print(token)
assert(json.decode(token) == 'say "hello"')