Skip to content
POST AI agent ready /v1/xml/to-json

XML to JSON API - Free Converter

Parses an XML document and returns its JSON equivalent. Attributes are prefixed with @ by convention. Text content is stored under the #text key. Handles CDATA sections, namespaces, and nested structures.

Parameters

stringrequired

The XML content to convert.

Code examples

curl -X POST https://api.botoi.com/v1/xml/to-json \
  -H "Content-Type: application/json" \
  -d '{"xml":"<user id=\"1\"><name>Alice</name><email>alice@example.com</email></user>"}'

When to use this API

Integrate with legacy SOAP services

Convert SOAP XML responses to JSON so your JavaScript or Python application can process the data with standard JSON libraries.

Parse RSS and Atom feeds

Convert RSS/Atom XML feeds to JSON for easier manipulation when building a feed reader or content aggregator.

Transform XML configuration files

Convert XML config files (Maven pom.xml, Android manifests) to JSON for analysis or transformation in CI pipelines.

Frequently asked questions

How are XML attributes represented in the JSON output?
Attributes are prefixed with "@". For example, <user id="1"> becomes {"user": {"@id": "1"}}.
How are CDATA sections handled?
CDATA content is extracted as a plain string and stored under the #text key, identical to regular text content.
Does this preserve XML namespaces?
Yes. Namespace prefixes are preserved in the JSON keys. For example, <ns:element> becomes a key named "ns:element".
What happens with mixed content (text + child elements)?
Mixed content stores the text in #text and child elements as separate keys. This matches the standard XML-to-JSON convention.

Get your API key

Free tier includes 5 requests per minute with no credit card required. Upgrade for higher limits.