Conversor JSON ↔ XML
Convierte entre JSON y XML — retornable para objetos anidados, arreglos y primitivos.
Respuesta rápida: Conversor JSON ↔ XML: convierte JSON en XML y XML en JSON; admite conversiones de ida y vuelta para objetos anidados, matrices y valores primitivos. Funciona íntegramente en el navegador, gratis y sin registro.
Última actualización
Bueno saber
JSON and XML model data differently, so the conversion is a best-effort mapping rather than a perfect round trip. JSON has arrays, objects, and typed primitives; XML has elements, attributes, ordered children, and mixed content. This tool maps object keys to element names and repeated elements to arrays, which covers the common case of hierarchical, element-only documents cleanly.
The biggest limitation to plan around is attributes. Attribute-heavy formats like SVG, XAML, or many configuration schemas store meaning in <tag attr="x">, and that information is not modeled here — so those conversions are lossy. Likewise, an element that happens to appear only once becomes a JSON object rather than a single-element array, which can surprise code that always expects a list. If your XML contract requires an array, wrap repeated elements in a parent container.
Because XML type information is weak (everything is text unless a schema says otherwise), a number like 42 may come back as the string "42" after a round trip. Coerce types explicitly in your consuming code rather than assuming they survived.
If your goal is simply to tidy up an XML document rather than convert it, the XML formatter preserves attributes, namespaces, and CDATA that this converter drops. For JSON-to-config workflows, the JSON ↔ YAML converter is often a better fit than XML.
Preguntas frecuentes
- ¿Por qué a veces se detectan incorrectamente los arreglos en XML → JSON?
- Un elemento XML que aparece exactamente una vez se convierte en un objeto, no en un arreglo de un solo elemento. Si necesitas un arreglo siempre, procesa el resultado después o envuelve elementos repetidos en un contenedor padre.
- ¿Qué pasa con los atributos XML?
- Actualmente no modelamos atributos — solo contenido de elementos y elementos hijos. Para XML con muchos atributos (SVG, XAML), la conversión es pérdida.
- ¿Sobrevivirá el contenido mixto (texto + elementos)?
- Parcialmente — el texto se conserva, pero el orden de texto/elementos mixtos puede cambiar. JSON no tiene un modelo nativo de contenido mixto.
- ¿Se preservan los espacios de nombre?
- Los nombres de elementos conservan su prefijo de espacio de nombre (por ejemplo, <code>soap:Envelope</code>) pero las declaraciones de espacio de nombre se pierden en el lado de JSON.
- ¿Mis archivos se subieron?
- No — ambas direcciones se ejecutan completamente en tu navegador.