Tools

Website SEO AuditBroken Link CheckerSchema Markup ValidatorAI Crawler CheckerInternal Link CheckerKeyword Cannibalization CheckerKeyword ClusteringKeyword SuggestionsKeyword GapSEO Content CheckerReadability CheckerKeyword DensityAI HumanizerWriting Pattern IndicatorSearch Console Regex GeneratorLong-Tail Keyword IdeasSERP Snippet PreviewMeta Tag GeneratorURL Slug GeneratorRobots.txt GeneratorMeta Title GeneratorMeta Description GeneratorOpen Graph GeneratorTwitter Card GeneratorHTML Meta TagsMeta Tags for WordPressMeta Tags for ShopifyMeta Tags for BloggerMeta Tags for WebflowMeta Tags for ReactMeta Tags for Next.jsCore Web Vitals CheckerImage CompressorHTML MinifierCSS MinifierJavaScript MinifierVideo & Image SpecsQR Code GeneratorCurrency ConverterScientific CalculatorLoan / EMI CalculatorMortgage CalculatorCompound Interest CalculatorSalary to Hourly CalculatorAge CalculatorDate Difference CalculatorJSON Formatter & ValidatorWord CounterMerge PDFSplit PDFRotate PDFDelete PDF PagesRearrange PDF PagesExtract PDF PagesCrop PDFJPG to PDFPNG to PDFPDF to JPGPDF to PNGResize ImageCrop ImageImage ConverterWebP to JPGHEIC to JPGProfile Photo MakerImage to Text (OCR)MOV to MP4MKV to MP4WebM to MP4AVI to MP4MP4 to MP3Extract Audio from VideoTrim VideoMute VideoVideo to GIFResize VideoCompress VideoM4A to MP3WAV to MP3OGG to MP3AAC to MP3Split CSVSplit ExcelCSV to ExcelExcel to CSVExcel to XMLXML to ExcelXML to CSVXML to JSONJSON to CSV
Data & File toolsFree, no sign-upRuns in your browser

XML to JSON

Convert XML into clean JSON. Repeated elements become arrays, attributes are kept with an @ prefix, and numbers can be typed automatically.

Or paste the content instead

How the conversion works

  • Elements become object keys; elements that repeat become arrays.
  • Attributes are kept with an @ prefix, e.g. "@id": 1.
  • Text next to attributes is stored under "#text".
  • Types: with conversion on, 42 becomes a number and true a boolean. Codes with leading zeros, like 007, stay as text.

How to use the XML to JSON: step by step

  1. Choose an XML file, or paste XML.
  2. Decide whether to keep attributes, convert numbers and true/false, and pretty-print.
  3. Click convert.
  4. Copy or download the JSON.

A real example

An old API returns <book id="7"><title>Dune</title><year>1965</year></book>. The JSON becomes {"book": {"@id": 7, "title": "Dune", "year": 1965}}, easy to use in JavaScript.

Tips for better results

  • Elements that repeat become arrays automatically.
  • Text next to attributes is stored under #text.
  • Turn off number conversion if values like ZIP codes have leading zeros.

More questions

Why did my ZIP code lose its leading zero?

“Convert numbers” turned it into a number. Turn that option off to keep values as text.

Is it private?

Yes, nothing leaves your device.

Frequently asked questions

Is my file uploaded anywhere?

No. The file is read and converted by your own browser, so it never leaves your device. That makes it safe for customer lists, finances and other private data.

Why is a single element not an array?

An element that appears once becomes a plain value; it becomes an array only when it repeats. If your code always expects arrays, check for both cases.

Are namespaces supported?

Yes. Prefixed tags like media:content are kept as key names exactly as written.