Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.

Convert XML file to json


I just try to integrate our automation testing tool with TestRail. I`m using curl to read the api.
The problem is that I get the results in a XML file. I have to convert it into json.

After converting it looks like this:

curl --insecure -H “Content-Type: application/xml” -u “xx xxx” -d “@D:\worksoft\curl\TRgetCase.xml” “

Error message: “Invalid or incomplete JSON string in API request”

Maybe someone can help me.



Yea - that is not JSON which is a match pair like this:
“id”: 1,
“name”: “A green door”,
“price”: 12.50,
“tags”: [“home”, “green”]

it does not have a xml ‘header’ or anything with < >.

Wonder if yo use a site like this if it will correctly convert XML to appropriate json:


Hi @Travelstar,

JSON and XML are two completely different formats/protocols and you can find working examples on how to use TestRail’s API here:

You can also use one of the API bindings to access the API directly from .NET, Java, etc.

Do you use the XML exports to extract data from TestRail? You can also use TestRail’s API for this instead and this would already be in JSON format (or the equivalent data structure if you use an API binding).

I hope this helps!