Skip to main content

Argumentos

any
requerido
Value que se encoded. nil, booleans, numbers, strings, tables y json.null se manejan directamente. Unsupported Lua types se encoded como null salvo que errorOnUnsupported sea true.
EncodeOptions
Optional encode options. json.encodePretty lee las mismas options que json.encode y luego fuerza pretty a true. Sin options usa un two-space indent. Un number define la indent width con clamp a 0.16, un string define el indent text, y una table puede definir sortKeys, emptyTableAsArray, errorOnUnsupported, encodeInvalidNumbersAsNull, maxDepth e indent.

Retornos

string
JSON string formateado y legible. Encoding errors se lanzan como Luau errors.

Tipos

EncodeOptions

Controla la serialización y el formato JSON.

Ejemplo

Encode JSON-compatible values como readable formatted JSON con pretty output forced on.