Category
JSON
Parse, encode, inspect, and transform JSON.Category guide
Overview
Use this overview to understand the category before opening a specific function.- See what this group of functions is meant to solve.
- Compare function names and descriptions in one table.
- Open a function for syntax, arguments, returns, and examples.
JSON
Available functions
| Function | Description |
|---|---|
json.array | Creates a new table marked as a JSON array for json.encode, copying the 1.#source sequence when a source table is provided. |
json.clone | Clones a value by encoding it with json.encode semantics and decoding the generated JSON back into Lua values. |
json.decode | Parses a JSON string with Real's JSON parser and returns the decoded Lua value, marking decoded arrays and objects for the JSON helpers. |
json.decodeSafe | Parses JSON with the same parsing behavior as json.decode and returns a success flag instead of throwing for parse errors. |
json.encode | Serializes a Lua value to a JSON string as JSON. |
json.encodePretty | Serializes a Lua value to a readable formatted JSON string as JSON. |
json.escape | Escapes a string using Real's JSON string escaping rules and returns the escaped content without surrounding quotes. |
json.format | Parses a JSON string and re-encodes it as readable formatted JSON using Real's JSON parser and encoder. |
json.getPath | Reads a nested value from a table using a dotted string path or an array table of keys. |
json.isArray | Returns whether a value is treated as a JSON array by Real's JSON table detection. |
json.isNull | Returns whether a value is Real's JSON null sentinel, json.null. |
json.isObject | Returns whether a value is treated as a JSON object by Real's JSON table detection. |
json.keys | Returns the visible keys of a table in a new table marked as a JSON array. |
json.minify | Parses a JSON string and re-encodes it with Real's default non-pretty JSON encoder output. |
json.object | Creates a new table marked as a JSON object so Real's JSON encoder treats it as an object. |
json.parse | Parses a JSON string like json.decode. |
json.pretty | Serializes a Lua value to a readable formatted JSON string like json.encodePretty. |
json.quote | Escapes a string using Real's JSON string escaping rules and returns a complete quoted JSON string literal. |
json.stringify | Serializes a Lua value to a JSON string like json.encode. |
json.tryDecode | Attempts to parse a JSON string like json.decodeSafe and returns status values for parse errors. |
json.type | Returns a string type name for a value. |
json.unescape | Decodes JSON string escape sequences from escaped string content or from a complete quoted JSON string literal. |
json.validate | Validates a JSON string by parsing one complete JSON value. |
json.values | Returns the direct values from a table in a new JSON array table. |