This API allows you to convert a raw XML string into a structured JSON format. It’s ideal for developers working with legacy XML feeds, SOAP APIs, or data migration from XML to JSON formats.
Endpoint Information
- URL:
https://node.nodetrigger.com/api/xml-to-json
- Method:
POST
- Content-Type:
application/json
Request Body
The API accepts a JSON object with the following field:
Field | Type | Required | Description |
---|---|---|---|
xml | String | Yes | The raw XML string to convert |
Example Request
{
"xml": "<person><name>John</name><age>30</age></person>"
}
Response
If the conversion is successful, the API will return a JSON object that represents the structure of the XML input.
Example Response
{
"json": {
"person": {
"name": "John",
"age": "30"
}
}
}
Error Handling
If something goes wrong, you’ll receive an error message:
Status Code | Message | Description |
---|---|---|
400 | Missing or invalid “xml” | The request body is empty or malformed |
500 | Failed to parse XML | The XML input could not be converted |
Notes
- This endpoint is optimized for lightweight XML documents.
- The output JSON is simplified by default (attributes are merged and arrays are flattened when possible).
- Large or deeply nested XML structures are supported, but ensure the XML is well-formed.