Convertir XML to JSON and back
Translate entre XML et JSON pour interoperability avec hérité APIs, preserving attributes, namespaces, et mixed content.
- 1
XML and JSON have different models: XML has attributes, namespaces, and mixed content; JSON has only objects, arrays, and scalars. Conversion requires conventions for representing attributes (e.g. @attr) and text content (e.g. #text).
- 2 Convertisseur JSON ↔ XML →
Paste XML to get JSON, or JSON to get XML. The tool uses a consistent convention for attributes and text nodes, and handles namespaces by prefixing.
- 3
Use the chain to convert JSON→XML with pretty-printing and proper declaration, for sending to XML-expecting APIs.
- 4 Formateur XML →
Formater or minify XML independently — useful when the XML is valid but hard to read, or needs compression for transport.
Questions fréquentes
- Why do attributes look different in the JSON?
- XML attributes have no direct JSON equivalent. Converters typically prefix them (e.g. @id for attribute id) or nest them under a special key. The convention varies by tool — check the output structure before consuming it.
- Can all XML be converted to JSON?
- Most XML can, but mixed content (text interspersed with child elements, like <p>Hello <b>world</b></p>) is awkward in JSON and requires array conventions. Namespaces and processing instructions may also be lost or represented differently.
Workflows résolvant cette tâche
Convertir JSON en XML
Traduire un document JSON en forme XML pour les intégrations legacy n'acceptant que XML. PIPELINE
Convertir JSON en XML formaté
Transformer un document JSON en XML et pretty-printer le résultat pour lisibilité. PIPELINE
Plist en JSON puis XML
Convertir Apple plist en JSON puis en XML générique. PIPELINE
Formater un document XML brut
Pretty-printer un document XML minifié ou non formaté pour révision humaine. PIPELINE
Convertir XML en JSON puis CSV
Aplatir un document XML en CSV via un intermediaire JSON pour consommation tableur. PIPELINE
XML en JSON puis YAML
Convertir XML en JSON puis en YAML pour la generation de configuration. PIPELINE
Outils associés
Convertisseur JSON ↔ XML
Convert between JSON and XML formats online. Gratuit, privé et 100% côté client. OUTIL
Formateur XML
Beautify or minify XML online with 2-space indentation. Gratuit, privé et 100% côté client. OUTIL
Formateur JSON
Format, minify, or sort JSON online. Gratuit, privé et 100% côté client. OUTIL