The XML-JSON Gateway API is a lightweight, containerized service that exposes powerful XML and JSON processing capabilities over HTTP.
It is designed for automation, integration pipelines, and server-side processing where XML/JSON files live on shared storage and must be queried, transformed, or converted without manual handling.
The service is built on Node.js, xmlstarlet, xmllint, and fast-xml-parser, and runs fully inside a Docker container.
- XPath-based XML extraction
- XML formatting (pretty-print)
- JSON formatting and repair
- XML ⇄ JSON conversion
- DTD removal from XML files
- Large XML support via streaming
- Optional file download via URL
- API-key–protected endpoints
- Swagger UI included
All endpoints require an API key:
x-api-key: <your-api-key>
- POST /xmlextract – Extract values from XML using XPath
- POST /xmlformat – Pretty-print XML
- POST /removedtp – Remove DTD from XML
- POST /jsonformat – Format and repair JSON
- POST /xmltojson – Convert XML to JSON
- POST /jsontoxml – Convert JSON to XML
| Parameter | Description |
|---|---|
| filePath | Source file path |
| saveTo | Optional output filename |
| viaUrl | Save result to download directory |
| logToConsole | Debug logging |
| asArray | XPath results as array |
http://<host>:3000/api-docs
docker build --build-arg API_KEY=your-key -t xml-json-gateway-api .
docker run -p 3000:3000 -v /data:/app/xmlfiles xml-json-gateway-api
ISC