NewAPIVerve Academy: free courses and certifications anyone can verify.Explore the Academy →

XML to JSON API

POST

Parse any raw XML payload into structured JSON.

XML to JSON is an XML to JSON converter API that turns raw XML strings into structured JSON objects. Send any valid XML payload to receive an organized JSON tree preserving tags, attributes, and child elements.

Try it — live request, no key required

Request
POSTapi.apiverve.com/v1/xmltojson
Body
Verification
Format

No key required to try it. Get a key to use it in your app.

Example
{
  "status": "ok",
  "error": null,
  "data": {
    "note": {
      "children": [
        {
          "to": {
            "content": "Tove"
          }
        },
        {
          "from": {
            "content": "Jani"
          }
        },
        {
          "heading": {
            "content": "Reminder"
          }
        },
        {
          "body": {
            "content": "Don't forget me this weekend!"
          }
        }
      ]
    }
  }
}

About the XML to JSON API

When you need to change XML to JSON inside an app or pipeline, POST the XML and read back JSON. The XML to JSON API parses the document and returns it as a nested JSON object that mirrors the element tree, with the root element as the top-level key, child elements in order and text content kept alongside them, so you can work with old SOAP responses, RSS feeds, sitemaps or config files using ordinary JSON tooling.

Integration developers use it when a partner, government feed or legacy system only speaks XML but the rest of the stack expects JSON, and in no-code tools where parsing XML by hand is awkward. Badly formed input is reported as an error with the parser's message rather than producing a half-converted object.

There is no plan difference: the Free plan and paid plans run the same conversion and return the same output.

How it works

The xml string is trimmed and must start with < and contain >; anything else is rejected with a 400 before parsing. The document is then converted with the simple-xml-to-json library, and the resulting object is returned directly as data, so its shape depends entirely on your XML rather than on a fixed schema.

The root element becomes the single top-level key. Each element is an object keyed by its tag name. Child elements are listed, in document order, in a children array, where each entry is itself a one-key object such as {"to": {"content": "Tove"}}. An element's text is placed in a content field. Because children are an array of single-key objects rather than a map, repeated tags such as several <item> elements are kept in order and none overwrite each other; iterate children and read each entry's key to find the tag.

If the parser throws, the response is a 400 that includes its message. Documents nested deeply enough to exhaust the parser's recursion return a 400 saying the document is nested too deeply to parse. An empty conversion result is also reported as invalid XML.

What people use it for

Legacy SOAP Integration
When ingesting legacy SOAP web service responses, modern frontend microservices parse the returned XML body into JSON before processing client requests.
RSS Feed Ingestion
News aggregators translate incoming XML syndication feeds into standard JSON records to index articles directly into document databases.
Supply Chain Invoices
To process electronic data interchange documents, logistics platforms convert supplier XML invoices into JSON payloads for internal billing services.
Webhook Payload Normalization
Convert XML notifications from payment gateways and partner APIs into JSON before passing event payloads to serverless event brokers.

Ways to call it

One endpoint, many ways in — REST with JSON, XML, YAML and CSV, plus GraphQL and an MCP interface for AI agents.

JSON
Default REST response
XML
Markup format
YAML
Human-readable
CSV
Tabular export
Beta
GraphQL
Query language
New
MCP
For AI agents

Other ways to use XML to JSON

Same data, same APIVerve account, same credit balance — one key works on all of them.

Questions.

Common questions about the XML to JSON API.

Read the docs →
How many XML conversions does the Free plan cover?
The Free plan covers 200 conversions each month at 1 credit per request. If you need higher volume, the Starter plan supports 200,000 conversions per month, which works out to about $0.15 per 1,000 conversions.
Can I submit raw XML strings directly in the request?
Yes. You send the XML content as a string parameter in a POST request. The XML to JSON API processes the string directly without requiring multipart file uploads.
How are nested child tags structured in the returned JSON?
Child elements are organized into an array under the root object. Each entry retains the element tag and its text content, preserving the structural hierarchy of your source document.
Will this handle third-party SOAP responses and RSS feeds?
Yes, as long as you pass the payload as an XML string. The converter parses the document hierarchy regardless of whether the source is a syndication feed, SOAP response, or custom export.
Does the returned JSON require additional cleanup before use?
No. The response returns valid JSON ready to be parsed by standard JSON libraries in your programming language.

Ready to build with XML to JSON? Start with 200 free credits — one key unlocks all 300+ APIs.

Explore the catalog

300+ APIs on the same key and the same response shape.

Browse all APIs