XML to JSON converter

Convert your XML data to a JSON object and verify its validity

How do we convert XML to JSON?

XML and JSON are popular formats to store or exchange data between systems. Both are text formats used to represent data in a structured way.

Mockoon supports JSON in all its systems but is also capable of parsing the XML content from entering requests. Mockoon uses the xml-js NPM library to convert XML.
This library is also used in the tool on this page to help you get a preview of the parsing result. It parses the XML in a way that ensures no data is lost during the conversion as there are some differences between XML and JSON.

Differences between XML and JSON

  • JSON uses mainly name/value pairs, while XML uses a tree structure with nested elements.
  • XML supports comments, while JSON does not.
  • XML supports element attributes, while JSON does not.
  • XML must have a single root element, while a JSON root element could be an array or an object.
  • XML supports namespaces. Namespaces are a way to avoid element name conflicts.