Skip to content

Tools/XML ↔ JSON

XML ↔ JSON

Convert XML to JSON and run XPath locally.

Also: XML to JSON · JSON to XML

Loading tool…

How to use XML ↔ JSON

  1. 1. Paste XML. Drop a .xml file or paste a document.
  2. 2. Read JSON. Attributes are prefixed with @.
  3. 3. Run XPath. Uses document.evaluate in this tab.
  4. 4. Copy either side. JSON or rebuilt XML.

About this tool

XML still shows up in SOAP, RSS, Android resources, and enterprise APIs. Converting it to JSON is how most TypeScript code wants to look at it. XPath is how you extract a node without writing a recursive walk.

Attributes and text

fast-xml-parser keeps attributes under @ keys. Mixed content (text plus children) is lossy if you expect a perfect round-trip.

XPath in the browser

The evaluator is the same engine as the DOM. Namespaces need local-name() if the document declares xmlns.

Code examples

XPath

//book[@id='b1']/title

Frequently asked questions

Related tools

All tools