메인 콘텐츠로 건너뛰기

인수

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-compatible values 를 encode 하고 empty array 가 array 로 유지되어야 하면 json.array 를 사용합니다.