Dev Tools icon

Dev Tools

A suite of utility tools for developers: Generators, converters, and transformers.

XML <-> JSON

AI-generated

Summary

Convert between XML and JSON formats according to the selected mode.

Inputs

  • Mode (required) — Choose 'XML to JSON' to parse XML input into JSON, or 'JSON to XML' to convert JSON input into XML.
  • Input Data (required) — The string containing either XML or JSON data for conversion, depending on the selected mode.

Output shape

a single JSON object when converting XML to JSON; an object with an 'xml' string property when converting JSON to XML

When converting from XML to JSON, the output is the parsed JSON object. When converting from JSON to XML, the output is an object containing the XML string in the 'xml' property. If JSON parsing fails during JSON to XML conversion, the input string is wrapped in an object under 'root' before conversion.

Links

Discussion