Skip to content
cosmodev ~/tools/xml-to-json

ตัวแปลง XML ↔ JSON

Converters & Formatters

แปลง XML เป็น JSON และกลับ โดยคง attribute ไว้ ตรวจสอบอินพุตและรายงานข้อผิดพลาดอย่างชัดเจน ทำงานในเบราว์เซอร์ของคุณทั้งหมด พร้อมลิงก์แชร์ไปยังข้อมูลที่คุณกรอก

JSON
วาง XML เพื่อดูการแปลงเป็น JSON

(เอกสารเป็นภาษาอังกฤษ)

What it does

Converts XML to JSON and JSON to XML, preserving attributes (encoded as @_name keys, per fast-xml-parser). XML is validated first, so malformed input reports an error instead of a broken result.

How to use it

  1. Pick a direction: XML → JSON or JSON → XML.
  2. Paste your input.
  3. Copy the result, or share a link.

Examples

XML: <user id="7"><name>Alice</name></user> → JSON: { "user": { "@_id": "7", "name": "Alice" } }

Good to know

  • Private: all conversion is local.
  • Attributes keep their values as strings; element text is coerced (numbers/booleans) on parse.
  • JSON → XML requires an object or array root.
  • Related tools: JSON Formatter, JSON Minify.
ซอร์สโค้ด14 ภาษา

100% ฝั่งไคลเอนต์ · ข้อมูลของคุณไม่ออกจากเบราว์เซอร์ของคุณเลย ใช้แล้วเป็นประโยชน์ไหม แชร์ให้เพื่อนร่วมงานได้เลย