สร้างชนิดข้อมูลจาก JSON
สร้าง TypeScript, Go หรือสคีมาจาก JSON
ทำงานในเบราว์เซอร์ · ไม่ต้องอัปโหลด
ขณะนี้เครื่องมือและคำแนะนำในหน้านี้ยังเป็นภาษาอังกฤษ แต่ทำงานเหมือนกันทุกประการ: ทุกอย่างทำงานในเบราว์เซอร์ของคุณ
เบราว์เซอร์ของคุณเก่าเกินไปที่จะใช้เครื่องมือนี้ โปรดอัปเดต หรือใช้ Chrome, Edge, Firefox หรือ Safari เวอร์ชันปัจจุบัน
- ไม่มีสิ่งใดออกจากอุปกรณ์ของคุณ
- เซิร์ฟเวอร์ไม่จำกัดขนาดไฟล์
- ไม่ต้องสมัคร ไม่มีลายน้ำ
- ฟรี
How to generate types from JSON
- Choose TypeScript, Go or JSON Schema.
- Paste an example of your JSON, or try the example.
- Adjust the options, then copy or download the code.
How the types are worked out
- Every object gets its own named type; items of arrays get a singular name ("users" becomes User).
- All items of an array are looked at together: a field missing from some items becomes optional.
- Numbers become number in TypeScript, and int64 or float64 in Go depending on the values.
- Mixed values become a union in TypeScript, any in Go and a list of types in JSON Schema.
- JSON Schema can also detect formats such as date-time, email, uri and uuid.
Check the result
The types describe your example, not every possible response. A field that was null or missing in the example can't tell what type it really has, so check those by hand.
คำถามที่พบบ่อย
Which JSON Schema version is used?
Draft 2020-12, the current version.
Is my JSON uploaded?
No. Everything happens in your browser, and the page is blocked from uploading anything.