แปลง YAML เป็น JSON และ JSON กลับเป็น YAML ได้ทั้งสองทิศทาง ตรวจสอบความถูกต้องขณะแปลงและแสดงข้อผิดพลาดที่ชัดเจน ทุกอย่างทำงานในเบราว์เซอร์ของคุณ
วิธีใช้ YAML ⇄ JSON
เลือกทิศทาง: YAML เป็น JSON หรือ JSON เป็น YAML
วาง YAML หรือ JSON ลงในแผงอินพุต
คัดลอกผลลัพธ์ที่แปลงแล้ว หรืออ่านข้อผิดพลาดหากอินพุตไม่ถูกต้อง
This converter transforms YAML into JSON and JSON into YAML, in both directions. Pick the direction, paste your input, and copy the converted result or read a clear error if the input is malformed.
Everything is processed locally in your browser, so your data stays on your device.
YAML and JSON describe the same kind of data, but with different priorities. JSON is strict and compact, which suits APIs and machines; YAML is indentation-based and easier for people to read and edit, which is why it dominates configuration files.
Each conversion parses the source first, so malformed input is caught and reported with the reason and often the line, instead of silently producing a broken result. A successful conversion therefore also tells you the input was valid.
It uses the YAML 1.2 and 1.1 compatible parser from js-yaml, covering the features you meet in practice: mappings, sequences, scalars, anchors and multi-line strings.
This is exactly the glue you need around CI pipelines, Kubernetes and Docker Compose files, and APIs that speak JSON while your config is written in YAML. It lets you move between the two without hand-editing.
One thing to know: YAML comments are dropped, because JSON has no concept of comments, and converting back generates fresh YAML without them.
คำถามที่พบบ่อย
ใช้ตัวแยกวิเคราะห์ที่เข้ากันได้กับ YAML 1.2/1.1 จาก js-yaml ครอบคลุมฟีเจอร์ทั่วไป: mappings, sequences, scalars, anchors และ multi-line strings
อินพุตถูกแยกวิเคราะห์ก่อนแปลง ดังนั้น YAML หรือ JSON ที่ไม่ถูกต้องจะแสดงข้อความพร้อมเหตุผลและบรรทัดที่เกิดปัญหา ซึ่งช่วยให้คุณระบุปัญหาได้เร็ว
ไม่ ความคิดเห็น YAML จะถูกลบระหว่างการแปลงเนื่องจาก JSON ไม่มีความคิดเห็น และการแปลงกลับจะสร้าง YAML ใหม่โดยไม่มีความคิดเห็น
ไม่ การแปลงทำงานทั้งหมดในเบราว์เซอร์ของคุณ ไม่มีสิ่งที่คุณวางออกจากอุปกรณ์
ฝังเครื่องมือนี้
เพิ่มเครื่องมือนี้ลงในเว็บไซต์ของคุณเอง คัดลอกสคริปต์ด้านล่าง โดยจะอัปเดตให้เป็นปัจจุบันโดยอัตโนมัติ
<iframe src="https://monu.tools/embed/th/yaml-json-converter" width="100%" height="640" style="border:1px solid #e5e5e5;border-radius:12px;max-width:680px" loading="lazy" title="Monu Tools"></iframe>เครื่องมือที่เกี่ยวข้อง
จัดรูปแบบ ทำให้สวยงาม และตรวจสอบ JSON ออนไลน์ พร้อมข้อความแสดงข้อผิดพลาดชัดเจนสำหรับข้อมูลที่ไม่ถูกต้อง
ย่อและตรวจสอบ JSON ในเบราว์เซอร์ของคุณ และดูว่าประหยัดได้กี่ไบต์
แปลง JSON เป็น CSV และ CSV กลับเป็น JSON ได้ทั้งสองทิศทาง เลือกตัวคั่น จัดการฟิลด์ที่มีเครื่องหมายอ้างอิง และคัดลอกผลลัพธ์ ทุกอย่างทำงานในเบราว์เซอร์ของคุณ
สร้าง TypeScript interfaces จากตัวอย่าง JSON พร้อม nested types, arrays และ optional fields ทำงานในเบราว์เซอร์ของคุณ