Argumente
any
erforderlich
Value, der encoded wird. nil, booleans, numbers, strings, tables und json.null werden direkt behandelt. Unsupported Lua types werden als null encoded, ausser errorOnUnsupported ist true.
EncodeOptions
Optional encode options. json.pretty liest dieselben options wie json.encodePretty und setzt danach pretty auf true. Ohne options nutzt es einen two-space indent. Eine number setzt die indent width, geclamped auf 0.16, ein string setzt den indent text, und eine table kann sortKeys, emptyTableAsArray, errorOnUnsupported, encodeInvalidNumbersAsNull, maxDepth und indent setzen.
Rückgaben
string
Readable formatted JSON string. Encoding errors werden als Luau errors geworfen.