JSON
JSON ↔ YAML / CSV / XML / TOML
แปลง JSON เป็น YAML, CSV, XML หรือ TOML และย้อนกลับ — ทั้งหมดในเบราว์เซอร์ ไม่ต้องใช้ไลบรารี
ข้อตกลง: แอตทริบิวต์คือคีย์ที่มี "@" (@id → แอตทริบิวต์ id), ข้อความของอิลิเมนต์แบบผสมคือคีย์ "#text", ลูกที่ซ้ำกันจะกลายเป็นอาร์เรย์
JSON, YAML, CSV, XML, and TOML all solve the same problem — structured data representation — with different syntax and different trade-offs. This tool converts between all of them in both directions, right in your browser.
How to use it
- Paste data in the source format and pick a target format — the conversion happens instantly.
- For CSV, the first row is automatically treated as column headers.
- Copy the result or download it as a file with the matching extension.
Common uses
- Converting an app's configuration from YAML to JSON (or back) to match a specific framework.
- Turning a spreadsheet export (CSV) into JSON for loading into a database or API.
- Reading a TOML config (common in the Rust/Python ecosystem) in the more familiar JSON format.
Things to keep in mind
JSON ↔ YAML and JSON ↔ TOML are usually lossless in both directions, since both formats support nesting the same way JSON does.
JSON → CSV loses nested structure: CSV is a flat tabular format, so nested objects and arrays either need to be flattened into separate columns or serialized as text.
บทความเกี่ยวกับเครื่องมือนี้: JSON ↔ YAML/CSV/XML/TOML: เมื่อไหร่และทำไมต้องแปลง
คำถามที่พบบ่อย
การแปลง JSON เป็น CSV ราบรื่นเสมอหรือไม่?
ราบรื่นเฉพาะข้อมูลที่ค่อนข้างแบนและเป็นตาราง object ที่ซ้อนลึกหรือ array ที่มีรูปร่างต่างกันจะไม่แมปลงในแถวและคอลัมน์แบนของ CSV ได้อย่างสะอาด ดังนั้นค่าที่ซ้อนกันมักถูกทำให้แบนหรือแปลงเป็นสตริง
เกิดอะไรขึ้นกับประเภทข้อมูลเมื่อแปลงเป็น YAML หรือ TOML?
ตัวแปลงจะรักษาประเภทไว้ในที่ที่รูปแบบปลายทางรองรับ (ตัวเลข บูลีน null) แต่รูปแบบอย่าง XML จะแสดงทุกอย่างเป็นข้อความ เว้นแต่คุณจะเพิ่มแอตทริบิวต์ประเภทอย่างชัดเจนเอง
ข้อมูลของฉันถูกอัปโหลดไปที่ไหนระหว่างการแปลงหรือไม่?
ไม่ การแปลงทั้งหมดทำงานในเบราว์เซอร์ของคุณ ไม่มีการส่งข้อมูลไปยังเซิร์ฟเวอร์
ทำไมตัวเลขหรือสตริงบางครั้งเปลี่ยนไปหลังแปลงเป็น YAML?
YAML parser จะพยายามเดาประเภทของค่าที่ไม่มีเครื่องหมายคำพูด: "1.20" อาจกลายเป็นตัวเลข 1.2 (สูญเสียเลขศูนย์ท้าย) และ "NO" อาจกลายเป็นบูลีน false ตามกฎเก่าของ YAML 1.1 เพื่อหลีกเลี่ยงปัญหานี้ ค่าที่ต้องคงเป็นสตริงควรใส่เครื่องหมายคำพูดอย่างชัดเจน
สามารถแปลงย้อนกลับได้โดยไม่สูญเสียข้อมูลหรือไม่?
JSON ↔ YAML และ JSON ↔ TOML มักย้อนกลับได้โดยไม่สูญเสียข้อมูล เพราะทั้งสองรูปแบบรองรับการซ้อนกันเหมือน JSON ส่วน JSON → CSV → JSON จะสูญเสียโครงสร้างที่ซ้อนกันไปหากมีอยู่เดิม — การแปลงย้อนกลับจะได้เพียงข้อมูลแบบแบนเท่านั้น