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

24 functions
FunctionDescription
json.arrayMarks a table as a JSON array so encoding keeps array semantics, including for empty tables.
json.cloneCreates a deep JSON-compatible copy of a value without sharing nested table references.
json.decodeParses a JSON string and returns the matching Luau value.
json.decodeSafeParses JSON without throwing and returns success, value, and error details.
json.encodeSerializes a Luau value into JSON using optional formatting and encoding rules.
json.encodePrettySerializes a Luau value into readable formatted JSON.
json.escapeEscapes text so it can safely appear inside a JSON string literal.
json.formatParses and re-encodes JSON to normalize formatting.
json.getPathReads a nested value from a table using a dotted path or path array.
json.isArrayReturns whether a value is marked or shaped as a JSON array.
json.isNullReturns whether a value is the JSON null sentinel.
json.isObjectReturns whether a value is marked or shaped as a JSON object.
json.keysReturns the keys of a JSON object as an array table.
json.minifyRemoves unnecessary whitespace from JSON while preserving its value.
json.objectMarks a table as a JSON object so encoding keeps object semantics.
json.parseAlias-style JSON parser that behaves like json.decode.
json.prettyAlias-style helper that serializes a value as formatted JSON.
json.quoteWraps and escapes text as a complete JSON string literal.
json.stringifyAlias-style JSON serializer that behaves like json.encode.
json.tryDecodeAttempts to parse JSON and returns structured error information instead of throwing.
json.typeReturns the JSON-aware type of a value, including array, object, and null markers.
json.unescapeConverts escaped JSON string content back into plain text.
json.validateValidates JSON and returns error details when parsing fails.
json.valuesReturns the values of a JSON object as an array table.