Skip to main content

الوسائط

any
مطلوب
Value الذي يتم encoded. nil و booleans و numbers و strings و tables و json.null يتم التعامل معها مباشرة. Unsupported Lua types يتم encoded كـ null إلا إذا كان errorOnUnsupported هو true.
EncodeOptions
Optional encode options. json.encodePretty يقرأ نفس options مثل json.encode، ثم يفرض pretty على true. بدون options يستخدم two-space indent. number تضبط indent width مع clamp إلى 0.16، و string تضبط indent text، و table يمكنها ضبط sortKeys و emptyTableAsArray و errorOnUnsupported و encodeInvalidNumbersAsNull و maxDepth و indent.

القيم الراجعة

string
Readable formatted JSON string. Encoding errors يتم رميها كـ Luau errors.

الأنواع

EncodeOptions

يتحكم في تسلسل JSON وتنسيقه.

مثال

Encode JSON-compatible values كـ readable formatted JSON مع pretty output forced on.