Skip to main content

引数

any
必須
Encoded する value。nil、booleans、numbers、strings、tables、json.null は直接処理されます。Unsupported Lua types は errorOnUnsupported が true でない限り null として encoded されます。
EncodeOptions
Optional encode options。json.pretty は json.encodePretty と同じ options を読み、その後 pretty を true に強制します。options がない場合は two-space indent を使います。number は 0.16 に clamp された indent width を設定し、string は indent text を設定し、table は sortKeys、emptyTableAsArray、errorOnUnsupported、encodeInvalidNumbersAsNull、maxDepth、indent を設定できます。

戻り値

string
Readable formatted JSON string。Encoding errors は Luau errors として throw されます。

型

EncodeOptions

JSON のシリアル化とフォーマットを制御します。

例

json.encodePretty alias を使って JSON-compatible values を readable formatted JSON として encode します。