Skip to main content

Arguments

string
required
JSON text สำหรับ parse. parser ยอมรับ JSON value หนึ่งค่าพร้อม optional surrounding whitespace และ throw เมื่อพบ invalid syntax หรือ trailing non-whitespace characters.
DecodeOptions
Optional decode options. boolean ตั้งค่า useNull โดยตรง. table สามารถตั้ง useNull และ maxDepth; maxDepth ถูก clamp จาก 1 ถึง 4096.

Returns

any
Decoded value. JSON objects และ arrays กลายเป็น tables พร้อม JSON type markers, strings กลายเป็น Lua strings, numbers กลายเป็น Lua numbers, booleans กลายเป็น booleans, และ null กลายเป็น json.null เว้นแต่ useNull เป็น false.

Types

DecodeOptions

ควบคุมพฤติกรรมการแยกวิเคราะห์ JSON

ตัวอย่าง

Decode JSON เป็น Lua values โดยคง JSON array, object และ null markers.