JSON
JSON Formatter / Minify / Validator
จัดรูปแบบ (เยื้อง 2 ช่องว่าง) บีบอัด และตรวจสอบ JSON ในเบราว์เซอร์โดยตรง
JSON Formatter turns any JSON into a readable, indented form, compresses it into a single compact line, or checks it for syntax errors. Everything runs in your browser — nothing you paste is sent anywhere.
How to use it
- Format: paste JSON into the input — a 2-space indented result appears immediately.
- Minify: switch to Minify mode to get compact JSON with no whitespace, ready to embed in code or send over the network.
- Validate: if the JSON is invalid, the tool points to the exact line and character where the syntax error occurs.
Common uses
- Reading an API response that arrived as one long unbroken line.
- Checking configuration files (package.json, tsconfig.json, etc.) before a commit.
- Minifying JSON before pasting it into an environment variable or a one-line config.
Things to keep in mind
Formatting never changes data types or key order — only the whitespace and line breaks around values.
Valid JSON doesn't allow trailing commas, comments, or single quotes — if your input has those, run it through JSON Repair first.
บทความเกี่ยวกับเครื่องมือนี้: JSON Formatter: การจัดรูปแบบ ย่อขนาด และตรวจสอบความถูกต้อง
คำถามที่พบบ่อย
"Format" กับ "Minify" ต่างกันอย่างไร?
Format เพิ่มการเยื้องและการขึ้นบรรทัดใหม่เพื่อให้ JSON อ่านง่าย ส่วน Minify ตัดช่องว่างที่ไม่จำเป็นทั้งหมดออกเพื่อให้ได้ผลลัพธ์เล็กที่สุดเท่าที่จะทำได้ — ทั้งสองแบบแทนข้อมูลชุดเดียวกันทุกประการ
ทำไมตัวตรวจสอบถึงแจ้งเตือน JSON ที่ฉันคิดว่าถูกต้องแล้ว?
ปัญหาที่พบบ่อยได้แก่ จุลภาคท้ายรายการ เครื่องหมายคำพูดเดี่ยวแทนที่จะเป็นคู่ คีย์ที่ไม่มีเครื่องหมายคำพูด หรือคอมเมนต์ — ไม่มีอันไหนถูกต้องใน JSON แบบเข้มงวด แม้ตัวแยกวิเคราะห์ที่ยืดหยุ่นกว่าอย่าง JSON5 จะยอมรับก็ตาม
JSON ของฉันถูกอัปโหลดไปที่ไหนตอนจัดรูปแบบหรือตรวจสอบหรือไม่?
ไม่ การจัดรูปแบบและตรวจสอบทั้งหมดทำในเบราว์เซอร์ของคุณ ไม่มีการส่งข้อมูลใดไปยังเซิร์ฟเวอร์
JSON5 หรือ JSONC ต่างจาก JSON มาตรฐานอย่างไร?
เป็นส่วนขยายที่อนุญาตให้มีคอมเมนต์ จุลภาคท้ายรายการ และคีย์ที่ไม่มีเครื่องหมายคำพูดเพิ่มเติม ตัวตรวจสอบ JSON แบบเข้มงวด (เช่นเครื่องมือนี้) จะปฏิเสธข้อความเช่นนี้อย่างถูกต้อง — ต้องใช้ parser แยกต่างหากที่รองรับ JSON5/JSONC โดยเฉพาะ
การจัดรูปแบบเปลี่ยนประเภทของข้อมูล เช่น ตัวเลข หรือไม่?
ไม่ การจัดรูปแบบและการย่อขนาดเป็นเพียงการจัดเรียงช่องว่างและการขึ้นบรรทัดใหม่รอบค่าเท่านั้น ตัวเลข สตริง ค่าบูลีน และ null ยังคงอยู่ในรูปแบบเดิม