Skip to main content

Đối số

any
bắt buộc
Value duoc encoded. nil, booleans, numbers, strings, tables va json.null duoc xu ly truc tiep. Unsupported Lua types duoc encoded thanh null tru khi errorOnUnsupported la true.
EncodeOptions
Optional encode options. json.encodePretty doc cung options nhu json.encode, sau do ep pretty thanh true. Khong co options thi dung two-space indent. number dat indent width duoc clamp ve 0.16, string dat indent text, va table co the dat sortKeys, emptyTableAsArray, errorOnUnsupported, encodeInvalidNumbersAsNull, maxDepth va indent.

Giá trị trả về

string
Readable formatted JSON string. Encoding errors duoc throw nhu Luau errors.

Kiểu

EncodeOptions

Kiểm soát việc tuần tự hóa và định dạng JSON.

Ví dụ

Encode JSON-compatible values thanh readable formatted JSON voi pretty output forced on.