Convert JSON Test Results to JUnit XML — Free Online
- Most CI test reporters parse JUnit XML — if your test framework emits JSON, you need to convert before CI can show pass/fail summaries.
- The browser tool gets you valid XML; post-convert you wrap it in
elements to match the JUnit schema. - For ongoing pipelines, use a proper reporter library — this is the quickest path when you're just prototyping or debugging one run.
Table of Contents
CI platforms (Jenkins, GitLab CI, CircleCI, GitHub Actions) show test pass/fail summaries when your pipeline produces JUnit XML. If your test framework emits JSON instead — Cucumber, Mocha with a JSON reporter, or a custom harness — you need a conversion step. This guide walks through the JSON-to-JUnit-XML shape so your CI picks up the results and a browser-based prototype workflow before you wire a proper reporter.
What JUnit XML Actually Needs
The JUnit XML format is a <testsuites> root with nested <testsuite> and <testcase> elements. Minimal skeleton:
<testsuites>
<testsuite name="checkout" tests="3" failures="1" time="0.42">
<testcase name="adds item to cart" classname="checkout.cart" time="0.12"/>
<testcase name="applies discount" classname="checkout.cart" time="0.08">
<failure message="expected 90 got 100">Assertion at cart.spec.js:42</failure>
</testcase>
<testcase name="calculates tax" classname="checkout.cart" time="0.22"/>
</testsuite>
</testsuites>
CI readers key off the tests, failures, errors, and skipped attributes on <testsuite>, plus the name/time attributes on each <testcase>. Failures have a nested <failure> element with a message.
Convert Your JSON, Then Reshape
Step 1: paste your JSON test output into the converter, set the root element to testsuites, click Convert. You get well-formed XML — but not yet JUnit-shaped.
Step 2: hand-edit to match the JUnit structure. Our converter outputs element-only XML, but JUnit requires attributes (name="...", tests="..."). See our attributes guide for the workaround — short find-and-replace or a small XSLT.
This is prototyping, not production. If you need this in CI forever, use a real reporter library (junit-xml-reporter, cucumber-junit) that emits the correct shape directly.
Sell Custom Apparel — We Handle Printing & Free ShippingCucumber JSON to JUnit XML
Cucumber emits JSON by default. Convert for CI reporting:
- cucumber-junit (Node) — drop-in, handles the shape transformation automatically. Use this in production.
- cucumber-reporting (Java) — generates JUnit output alongside HTML reports.
- Manual via our converter — paste Cucumber JSON, convert, hand-massage into JUnit shape. Fine for debugging one run.
The manual path is worth it when you've got a single failing pipeline to debug and don't want to add tooling. Don't ship a manual conversion step.
The Attributes Problem — Why You Can't Just Paste
JUnit XML relies heavily on attributes. Our converter outputs element-only XML. A JSON {"tests":3} becomes <tests>3</tests>, not tests="3" on the parent. For a one-time conversion, the fastest fix is find-and-replace:
s|<testsuite>\s*<name>([^<]+)</name>\s*<tests>([^<]+)</tests>|<testsuite name="\1" tests="\2">|
Or restructure the JSON to flatten attribute-target keys before converting. For repeated work, write a real reporter.
Which CI Platforms Expect JUnit XML
- Jenkins: JUnit Plugin parses
**/TEST-*.xmlby default. - GitLab CI:
artifacts.reports.junitconfiguration in.gitlab-ci.yml. - CircleCI:
store_test_resultsstep pointing at a directory of JUnit XML. - GitHub Actions: via
dorny/test-reporteror similar actions that read JUnit XML. - Azure DevOps:
PublishTestResults@2task withtestResultsFormat: JUnit.
If your test framework doesn't emit JUnit natively, the quickest win is a reporter library. Fall back to JSON-to-XML conversion only for prototyping.
Prototype Your JUnit XML in 30 Seconds
Paste JSON test output, convert to XML, reshape to JUnit. No CI plugin install to debug one pipeline.
Open Free JSON to XML ConverterFrequently Asked Questions
Can CI tools read JSON test results directly?
Some can with plugins, but JUnit XML is the universal format. GitHub Actions reporters, GitLab CI, and Jenkins all default to JUnit XML. Converting JSON to JUnit XML unlocks the built-in test-summary UI without additional plugin hunting.
Does this converter produce valid JUnit XML directly?
No — it produces well-formed XML, but JUnit uses attributes (name="...", tests="3") which our tool outputs as child elements instead. You'll need a find-and-replace or small XSLT to reshape to JUnit format.
What's the fastest path to JUnit XML from Mocha?
mocha-junit-reporter. Install, add --reporter mocha-junit-reporter, done. Takes 2 minutes. Manual JSON-to-XML conversion is only worth it if you can't add dependencies.
Can I use this for a Postman/Newman test run?
Newman has a --reporters junit flag built in. Use that. JSON-to-XML conversion is only needed if you've got output from a framework with no JUnit reporter.

