XML JSON Converter avatar

XML JSON Converter

Pricing

$0.20 / 1,000 completed conversions

Go to Apify Store
XML JSON Converter

XML JSON Converter

Convert XML to JSON and JSON to XML from pasted data or public URLs. Run one task or bulk conversions, then export structured JSON, XML strings, source URLs, and input previews from the dataset.

Pricing

$0.20 / 1,000 completed conversions

Rating

0.0

(0)

Developer

Maxime Dupré

Maxime Dupré

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

2 days ago

Last modified

Categories

Share

🔄 XML JSON converter for bulk data conversion

XML JSON Converter converts XML to JSON and JSON to XML from pasted data or public URLs. Use it when you need a clean Apify dataset for API workflows, exports, integrations, config migration, RSS or SOAP response cleanup, or repeatable structured data conversion.

Each successful conversion is saved as one dataset item. XML-to-JSON tasks return structured JSON in convertedJson, so you can query or export the result without parsing a JSON string yourself. JSON-to-XML tasks return an XML string in convertedXml, including an XML declaration and your chosen root element.

The Actor auto-detects whether each task is XML or JSON. Add one task for a quick conversion, or add many tasks to process a batch in one run.

✅ What this Actor does

  • Converts XML to JSON from pasted XML or a public XML URL.
  • Converts JSON to XML from pasted JSON or a public JSON URL.
  • Auto-detects the conversion direction for each task.
  • Handles bulk conversion tasks in one run.
  • Preserves XML attributes under @attributes when converting to JSON.
  • Supports nested XML, repeated elements, CDATA, text nodes, namespace-prefixed names, objects, arrays, strings, numbers, booleans, and nulls where the parser can represent them.
  • Lets you choose readable or compact output.
  • Lets you set the XML root element and array item element for JSON-to-XML output.
  • Skips invalid or unreachable tasks while continuing with the rest of the batch.
  • Saves only successful conversions to the dataset.

This Actor is a deterministic converter. It does not use AI, repair invalid XML or JSON, infer schemas, convert CSV/YAML/HTML, crawl websites, or access private URLs that require login.

📥 Input

Add conversion tasks in tasks. Each task can contain pasted data, a public URL, or both. If both are present, the pasted data is used for that task.

{
"tasks": [
{
"inputData": "<catalog><book id=\"1\"><title>Dune</title><author>Frank Herbert</author></book></catalog>"
},
{
"inputData": "{\"employees\":[{\"name\":\"Alice\",\"role\":\"Engineer\"},{\"name\":\"Bob\",\"role\":\"Manager\"}]}"
},
{
"inputUrl": "https://www.w3schools.com/xml/note.xml"
}
],
"prettyPrint": true,
"rootElement": "company",
"arrayItemElement": "employee"
}

🧾 Input fields

FieldWhat it does
tasksList of XML or JSON conversion tasks. Each item can use inputData or inputUrl.
inputDataPasted XML or JSON text for one task.
inputUrlPublic HTTP or HTTPS URL of an XML or JSON file.
prettyPrintKeeps converted XML readable when true. Turn it off for compact XML.
rootElementRoot element name for JSON-to-XML output.
arrayItemElementElement name for JSON array items when an array needs an item wrapper.

Private or authenticated files should be fetched outside the Actor and pasted into inputData. The Actor does not accept cookies, source credentials, or API keys for source URLs.

📤 Output

Each dataset item is one successful conversion.

FieldDescription
taskIndex1-based position of the task in your input.
sourceUrlPublic URL used for the task, or null when pasted data was used.
inputPreviewShort preview of the converted input.
convertedJsonStructured JSON value for XML-to-JSON tasks. null for JSON-to-XML tasks.
convertedXmlXML string for JSON-to-XML tasks. null for XML-to-JSON tasks.

🧪 XML to JSON output example

{
"taskIndex": 1,
"sourceUrl": null,
"inputPreview": "<catalog><book id=\"1\"><title>Dune</title><author>Frank Herbert</author></book></catalog>",
"convertedJson": {
"catalog": {
"book": {
"@attributes": {
"id": 1
},
"title": "Dune",
"author": "Frank Herbert"
}
}
},
"convertedXml": null
}

🧪 JSON to XML output example

{
"taskIndex": 2,
"sourceUrl": null,
"inputPreview": "{\"employees\":[{\"name\":\"Alice\",\"role\":\"Engineer\"}]}",
"convertedJson": null,
"convertedXml": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<company>\n <employees>\n <name>Alice</name>\n <role>Engineer</role>\n </employees>\n</company>"
}

🚀 How to run it

  1. Open the Actor input.
  2. Add one or more items in Conversion tasks.
  3. Paste XML or JSON into inputData, or add a public XML/JSON URL in inputUrl.
  4. Keep Readable output on for easier inspection, or turn it off for compact XML output.
  5. Set XML root element and XML array item element when you are converting JSON to XML.
  6. Run the Actor and open the dataset.

For an Apify QA-style first run, keep the prefilled XML and JSON batch. For a tiny manual test, delete most tasks and leave one XML task plus one JSON task.

💡 Common use cases

  • Convert XML API responses to structured JSON for analysis.
  • Convert JSON payloads to XML for legacy systems.
  • Batch-convert config files, feeds, or integration payloads.
  • Keep source URL and task position attached to each converted result.
  • Schedule repeat conversions for public XML or JSON files.
  • Export converted data to JSON, CSV, Excel, XML, RSS, or HTML from Apify.
  • Use the dataset through the Apify API, webhooks, or integrations.

💰 Pricing

The Actor charges only for successful conversions. Invalid XML, invalid JSON, empty tasks, unreachable URLs, and unsupported URLs do not save dataset items and are not charged as completed conversions.

The local pricing event is conversion-completed at $0.0002 per successful conversion. There is no actor-start charge in the pricing artifact.

⚠️ Limits and caveats

  • Source URLs must be public http or https URLs.
  • Private URLs, signed URLs that expire, login-only files, cookies, and source credentials are not supported.
  • Invalid XML and invalid JSON are skipped and reported in logs.
  • The Actor preserves parser-backed structure, but it does not semantically repair malformed data.
  • JSON-to-XML element names come from your rootElement, arrayItemElement, and JSON object keys, so use XML-safe names.
  • This is not a universal data converter. CSV, TSV, YAML, HTML table extraction, and website crawling are outside this Actor.

❓ FAQ

Can this convert XML to JSON from a URL?

Yes. Add a public XML URL in inputUrl. The output is saved in convertedJson.

Can this convert JSON to XML?

Yes. Paste JSON or add a public JSON URL. The output is saved in convertedXml.

Do I need to choose XML to JSON or JSON to XML?

No. The Actor auto-detects the input format for each task.

What happens when one task is invalid?

The invalid task is skipped, a warning is logged, and the rest of the batch continues. Only successful conversions are saved to the dataset.

Does it support authenticated URLs?

No. For private or authenticated files, fetch the content yourself and paste it into inputData.

📝 Changelog

  • 0.0: Initial release.

🆘 Support

For issues, questions, or feature requests, file a ticket and I'll fix or implement it in less than 24h 🫡

🔗 Other actors

  • RSS Feed Reader ↗ - Read public RSS, Atom, RDF, and JSON Feed URLs into clean feed item data.
  • Sitemap Sniffer ↗ - Find sitemap files, sitemap indexes, and optional URL inventory rows for SEO audits.
  • Robots.txt Generator ↗ - Generate deployable robots.txt files from presets, bot rules, sitemap URLs, and host directives.
  • Font Detector ↗ - Detect loaded web fonts, CSS font-family declarations, and font source evidence from public pages.
  • Email MX Verifier ↗ - Check email syntax, MX records, disposable domains, role addresses, and list-cleaning decisions.

Made with ❤️ by Maxime Dupré