Skip to main content

Argumen

any
wajib
Value yang di-encoded. nil, booleans, numbers, strings, tables, dan json.null ditangani langsung. Unsupported Lua types di-encoded sebagai null kecuali errorOnUnsupported bernilai true.
EncodeOptions
Optional encode options. json.encodePretty membaca options yang sama seperti json.encode, lalu memaksa pretty menjadi true. Tanpa options, fungsi memakai two-space indent. number mengatur indent width dengan clamp ke 0.16, string mengatur indent text, dan table dapat mengatur sortKeys, emptyTableAsArray, errorOnUnsupported, encodeInvalidNumbersAsNull, maxDepth, dan indent.

Return

string
Readable formatted JSON string. Encoding errors dilempar sebagai Luau errors.

Tipe

EncodeOptions

Mengontrol serialisasi dan pemformatan JSON.

Contoh

Encode JSON-compatible values sebagai readable formatted JSON dengan pretty output forced on.