JSON

The static global JSON class provides encoding and decoding functions for JSON strings. Encode a variable into a valid JSON string using JSON.encode(variable) or JSON.encode_pretty(variable). Decode a valid JSON string into a variable using JSON.decode(json_string).

NOTE: JSON encoding and decoding will not work with Object references.

Functions

Return ValueFunction NameDescription
variabledecode(string json_string)Decodes a valid JSON string into a Lua string, number, or Table.
stringencode(variable)Encodes a Lua string, number, or Table into a valid JSON string. This will not work with Object references.
stringencode_pretty(variable)Encodes a Lua string, number, or Table into a valid JSON string formatted with indents (Human readable). This will not work with Object references.