JSON
JSON Schema Validator
ตรวจสอบข้อมูล JSON ให้ตรงตาม JSON Schema (สไตล์ draft-07) — พร้อมเส้นทางที่แน่นอนและคำอธิบายสำหรับแต่ละข้อผิดพลาด
JSON Schema describes the expected structure of a JSON document — which fields are required, what type they are, and what constraints apply to their values. This tool checks actual data against a schema and shows the exact path to every violation.
How to use it
- Paste a JSON Schema into one field and the data to validate into the other.
- The result lists each violation separately: the exact path to the problem field and a plain-language explanation of why it doesn't match the schema.
- Valid data is immediately flagged as fully compliant with the schema.
Common uses
- Checking a third-party API response against its documented schema before integrating with it.
- Debugging your own JSON Schema — figuring out why seemingly valid data gets rejected.
- Validating a configuration file against a schema before deploying.
Things to keep in mind
JSON Schema has several versions (draft-07, 2019-09, 2020-12) with small syntax differences — check which version your production validator actually expects.
required only checks that a field is present, not its value — an empty string or null still counts as "present" if the type allows it.
บทความเกี่ยวกับเครื่องมือนี้: JSON Schema: วิธีอธิบายและตรวจสอบโครงสร้างของ JSON
คำถามที่พบบ่อย
การตรวจสอบด้วย JSON Schema ตรวจสอบอะไรกันแน่?
มันตรวจสอบว่าข้อมูล JSON ของคุณตรงกับกฎที่กำหนดไว้ใน schema หรือไม่ — ฟิลด์ที่จำเป็น ประเภทข้อมูล ช่วงค่า รูปแบบสตริง และอื่น ๆ — ไม่ใช่แค่ตรวจว่า JSON เองถูกต้องตามไวยากรณ์
เครื่องมือนี้รองรับ JSON Schema draft ใด?
เครื่องมือนี้ตรวจสอบตาม draft-07 ซึ่งเป็นหนึ่งในเวอร์ชันที่ใช้กันแพร่หลายที่สุด — schema ที่เขียนสำหรับ draft อื่นอาจใช้คำสำคัญที่ไม่รู้จักที่นี่
schema หรือข้อมูลของฉันถูกส่งไปที่ไหนเพื่อตรวจสอบหรือไม่?
ไม่ การตรวจสอบทำงานทั้งหมดในเบราว์เซอร์ของคุณด้วยไลบรารี JavaScript ไม่มีการส่งข้อมูลไปยังเซิร์ฟเวอร์
additionalProperties: false ทำหน้าที่อะไร?
โดยค่าเริ่มต้น object สามารถมีฟิลด์ใดก็ได้เพิ่มเติมนอกเหนือจากที่ระบุใน properties additionalProperties: false ห้ามฟิลด์ส่วนเกิน — มีประโยชน์ในการจับข้อผิดพลาดจากการพิมพ์ชื่อคีย์ผิดหรือฟิลด์ debug ที่หลงเหลืออยู่โดยไม่ตั้งใจ
สามารถกำหนดฟิลด์ที่รับได้หลายประเภทหรือไม่?
ได้ ผ่านอาร์เรย์ใน type เช่น "type": ["string", "null"] หากฟิลด์นั้นอาจเป็นสตริงหรือ null สำหรับกรณีที่ซับซ้อนกว่านั้นให้ใช้คำสำคัญ oneOf, anyOf หรือ allOf