Edit online

Oxygen XML Editor includes a useful and simple tool for converting XML files to JSON. The XML to JSON action for invoking the tool can be found in the Tools > JSON Tools menu.

To convert an XML document to JSON, follow these steps:

  1. Select the XML to JSON action from the Tools > JSON Tools menu.

    Step Result: The XML to JSON dialog box is displayed:

    Figure 1. XML to JSON Dialog Box
  2. Choose or enter the Input URL of the XML document.
  3. Choose the path of the Output file that will contain the resulting JSON document.
  4. Select the Open in Editor option to open the resulting JSON document in the main editing pane.
  5. Click the Convert button.

Result: The original XML document is now converted to a JSON document.

Figure 2. Example: XML to JSON Operation Result

Conversion Details

  • If any elements contain attributes in the XML document, the attributes are converted to properties in the converted JSON document. If the XML document contains more than one element with the same name, they will be converted into an array of object in the converted JSON document.

    For example, the following XML document:
      <person id="person.one">
      <person id="person.two">
    it is converted to:
      "personnel": {
        "person": [
            "id": "person.one",
            "name": "Boss"
            "id": "person.two",
            "name": "Worker"
  • If the XML document contains elements with mixed content (text plus elements), the converted JSON document will contain a #text property with its value set as the text content. If there are multiple text nodes, the subsequent #text properties will contain a number (i.e. #text1, #text2).
      <name>Boss <i>One</i>!</name>
    is converted to:
      "person": {
        "name": {
          "#text": "Boss",
          "i": "One"
          "#text1": "!"
  • If the XML document contains element names that contains hexadecimal codes (for example, if they were escaped during a JSON to XML conversion), it will be converted to the normal character value in the converted JSON document.
    is converted to:
    {"$id": "personnel-id"}

Online XML to JSON Converter

For a simple ONLINE tool for converting a single XML file to JSON, or vice versa, go to: https://www.oxygenxml.com/xml_json_converter.html.