/xml-to-json : An api to convert xml to json

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:

FieldTypeRequiredDescription
xmlStringYesThe 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 CodeMessageDescription
400Missing or invalid “xml”The request body is empty or malformed
500Failed to parse XMLThe 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.