JSON

json.unescape

Converts escaped JSON string content back into plain text.

Syntax

json.unescape(text: string): string

Arguments

NameTypeDescription
textstringText value used by the operation.

Returns

NameTypeDescription
textstringUnescaped text value.

Description

Converts escaped JSON string content back into plain text.

Call it with 1 parameter(s): text. The argument table explains which values are required and which ones only refine the behavior.

It returns text (string). Use the returns table to separate successful values from nil results and recoverable errors.

Example

Restore escaped or quoted JSON string content.

local quoted = json.quote("Real Docs" .. string.char(10) .. "Docs")
local restored = json.unescape(quoted)

print(restored)