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합니다.