apyhub
DATA EXTRACTION · DEVELOPER TOOLS

Convert Raw XML to JSON API

What it does

XML to JSON converts an XML document into a JSON object while preserving element attributes and text content. Send XML in the xml field and get back a parsed response with data and, when available, the document root name.

Use XML to JSON when you need to normalize XML feeds into a format that is easier to inspect, store, or pass to downstream services. It is useful for import pipelines, integrations with legacy systems, and any workflow that expects JSON rather than nested XML nodes.

The input schema is minimal: a request body containing a single xml string. The response is similarly straightforward, returning the converted payload as data and a root string for the top-level element. That makes it a good fit for backend jobs, middleware, and developer tooling where predictable structure matters.

If you work with XML from partners, webhooks, or exported documents, XML to JSON gives you a consistent JSON representation without asking you to build your own parser.

POST
Parse an XML document into a JSON object preserving attributes and text
http://localhost:8080/dosvak/raw-xml-to-json
QUICKSTARTGUIDE

Quickstart

Send your XML in a JSON body to convert it to JSON.

curl -X POST "http://localhost:8080/dosvak/raw-xml-to-json" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"xml":"<root><item id=\"1\">hello</item></root>"}'

What you'll get back

Returns a JSON object with data and root top-level fields. root is a string; data is present in the schema but has no declared type or shape.

{
  "data": {},
  "root": "root"
}
TRY ITLIVE · 10 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*

About this endpoint

What it does

Parses an XML document sent in the request body and returns a JSON response containing the parsed result. The response schema declares a top-level data field and a top-level root string field.

Request Body

ParameterTypeMandatoryDescription
xmlStringYesThe XML document to parse.

Response

Returns a JSON object with a data field and a root string field.

ParameterTypeMandatoryDescription
dataObjectNoParsed response payload. The schema does not further define its shape.
rootStringNoString value returned by the API.

Body

Name
Type
Description
bodyREQUIRED
object
▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.