Skip to content

Repository files navigation

XML-JSON Gateway API

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.


Key Features

  • 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

Authentication

All endpoints require an API key:

x-api-key: <your-api-key>

Available Endpoints

XML Operations

  • POST /xmlextract – Extract values from XML using XPath
  • POST /xmlformat – Pretty-print XML
  • POST /removedtp – Remove DTD from XML

JSON Operations

  • POST /jsonformat – Format and repair JSON

Conversion Operations

  • POST /xmltojson – Convert XML to JSON
  • POST /jsontoxml – Convert JSON to XML

Common Parameters

Parameter Description
filePath Source file path
saveTo Optional output filename
viaUrl Save result to download directory
logToConsole Debug logging
asArray XPath results as array

Swagger UI

http://<host>:3000/api-docs

Docker

Build

docker build --build-arg API_KEY=your-key -t xml-json-gateway-api .

Run

docker run -p 3000:3000 -v /data:/app/xmlfiles xml-json-gateway-api

License

ISC

About

xmlStarlet in a docker container which can be requested via API to return the dedicated values

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages