メインコンテンツへスキップ

引数

any
必須
Encode される value。nil、booleans、numbers、strings、tables、json.null は直接処理されます。Unsupported Lua types は errorOnUnsupported が true でない限り null として encode されます。
EncodeOptions
Optional encode options。boolean は pretty output を切り替えます。number は 0.16 に clamp された spaces 数で pretty output を有効にします。string はその indent で pretty output を有効にします。table は pretty、sortKeys、emptyTableAsArray、errorOnUnsupported、encodeInvalidNumbersAsNull、maxDepth、indent を設定できます。

戻り値

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

型

EncodeOptions

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

例

json.encode と同じ function を使って JSON-compatible values を encode します。