{"id":20950416,"url":"https://github.com/atomgraph/json2xml","last_synced_at":"2025-08-02T04:34:34.398Z","repository":{"id":147849142,"uuid":"177875251","full_name":"AtomGraph/JSON2XML","owner":"AtomGraph","description":"Streaming generic JSON to XML converter. Uses XSLT 3.0 XML representation.","archived":false,"fork":false,"pushed_at":"2023-08-31T19:08:57.000Z","size":47,"stargazers_count":21,"open_issues_count":1,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-07-25T17:59:48.131Z","etag":null,"topics":["converter","docker-image","json","json2xml","streaming","transformation","xml","xslt","xslt-3"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/atomgraph/json2xml","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AtomGraph.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-03-26T22:01:50.000Z","updated_at":"2025-06-25T11:18:27.000Z","dependencies_parsed_at":"2025-07-25T13:39:55.261Z","dependency_job_id":"5d37966e-56b8-463a-b169-092cc9a64207","html_url":"https://github.com/AtomGraph/JSON2XML","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/AtomGraph/JSON2XML","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AtomGraph%2FJSON2XML","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AtomGraph%2FJSON2XML/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AtomGraph%2FJSON2XML/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AtomGraph%2FJSON2XML/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AtomGraph","download_url":"https://codeload.github.com/AtomGraph/JSON2XML/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AtomGraph%2FJSON2XML/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268334622,"owners_count":24233793,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["converter","docker-image","json","json2xml","streaming","transformation","xml","xslt","xslt-3"],"created_at":"2024-11-19T00:48:25.655Z","updated_at":"2025-08-02T04:34:34.391Z","avatar_url":"https://github.com/AtomGraph.png","language":"Java","readme":"# JSON2XML\nStreaming JSON to XML converter\n\nReads any JSON data and produces [XML Representation of JSON](https://www.w3.org/TR/xslt-30/#json-to-xml-mapping) specified in XSLT 3.0.\n\nJSON2XML enables JSON transformation with XSLT even without having an XSLT 3.0 processor. You can simply pre-process the data by having JSON2XML before the transformation, and pipeline it into an XSLT 2.0 stylesheet, for example. That way your stylesheet stays forward compatible with XSLT 3.0, as the XML representation is exactly the same.\n\n## Invalid characters\n\nThe JSON input might contain characters (for example, form feed `\\f`) which would be invalid in the XML output. The [`json-to-xml()` function](https://www.w3.org/TR/xslt-30/#func-json-to-xml) specifies character escape rules that apply in this case.\n\nJSON2XML currently implements only the default escape rule: \n\u003e Any characters or codepoints that are not valid XML characters (for example, unpaired surrogates) are passed to the fallback function as described below; in the absence of a fallback function, they are replaced by the Unicode `REPLACEMENT CHARACTER (xFFFD)`.\n\n## Build\n\n    mvn clean install\n\nThat should produce an executable JAR file `target/json2xml-jar-with-dependencies.jar` in which dependency libraries will be included.\n\n## Maven\n\nEach version is released to the Maven central repository as [`com.atomgraph.etl.json/json2xml`](https://central.sonatype.com/artifact/com.atomgraph.etl.json/json2xml)\n\n## Usage\n\nThe JSON data is read from `stdin`, UTF-8 encoding is expected. The resulting XML data is written to `stdout`.\n\nJSON2XML is available as a `.jar` as well as a Docker image [atomgraph/json2xml](https://hub.docker.com/r/atomgraph/json2xml) (recommended).\n\n## Example\n\nJSON data in `city-distances.json`:\n\n```json\n{\n  \"desc\"    : \"Distances between several cities, in kilometers.\",\n  \"updated\" : \"2014-02-04T18:50:45\",\n  \"uptodate\": true,\n  \"author\"  : null,\n  \"cities\"  : {\n    \"Brussels\": [\n      {\"to\": \"London\",    \"distance\": 322},\n      {\"to\": \"Paris\",     \"distance\": 265},\n      {\"to\": \"Amsterdam\", \"distance\": 173}\n    ],\n    \"London\": [\n      {\"to\": \"Brussels\",  \"distance\": 322},\n      {\"to\": \"Paris\",     \"distance\": 344},\n      {\"to\": \"Amsterdam\", \"distance\": 358}\n    ],\n    \"Paris\": [\n      {\"to\": \"Brussels\",  \"distance\": 265},\n      {\"to\": \"London\",    \"distance\": 344},\n      {\"to\": \"Amsterdam\", \"distance\": 431}\n    ],\n    \"Amsterdam\": [\n      {\"to\": \"Brussels\",  \"distance\": 173},\n      {\"to\": \"London\",    \"distance\": 358},\n      {\"to\": \"Paris\",     \"distance\": 431}\n    ]\n  }\n}\n```\n\nJava execution from shell:\n\n    cat city-distances.json | java -jar json2xml-jar-with-dependencies.jar \u003e city-distances.xml\n\nAlternatively, Docker execution from shell:\n\n    cat city-distances.json | docker run --rm -i -a stdin -a stdout -a stderr atomgraph/json2xml \u003e city-distances.xml\n\nNote that you need to [bind](https://docs.docker.com/engine/reference/commandline/run/#attach-to-stdinstdoutstderr--a) `stdin`/`stdout`/`stderr` when running JSON2XML as a Docker container.\n\nOutput in `city-distances.xml` (indented for clarity):\n\n```xml\n\u003c?xml version=\"1.0\" ?\u003e\n\u003cmap xmlns=\"http://www.w3.org/2005/xpath-functions\"\u003e\n  \u003cstring key=\"desc\"\u003eDistances between several cities, in kilometers.\u003c/string\u003e\n  \u003cstring key=\"updated\"\u003e2014-02-04T18:50:45\u003c/string\u003e\n  \u003cboolean key=\"uptodate\"\u003etrue\u003c/boolean\u003e\n  \u003cnull key=\"author\"/\u003e\n  \u003cmap key=\"cities\"\u003e\n    \u003carray key=\"Brussels\"\u003e\n      \u003cmap\u003e\n        \u003cstring key=\"to\"\u003eLondon\u003c/string\u003e\n        \u003cnumber key=\"distance\"\u003e322\u003c/number\u003e\n      \u003c/map\u003e\n      \u003cmap\u003e\n        \u003cstring key=\"to\"\u003eParis\u003c/string\u003e\n        \u003cnumber key=\"distance\"\u003e265\u003c/number\u003e\n      \u003c/map\u003e\n      \u003cmap\u003e\n        \u003cstring key=\"to\"\u003eAmsterdam\u003c/string\u003e\n        \u003cnumber key=\"distance\"\u003e173\u003c/number\u003e\n      \u003c/map\u003e\n    \u003c/array\u003e\n    \u003carray key=\"London\"\u003e\n      \u003cmap\u003e\n        \u003cstring key=\"to\"\u003eBrussels\u003c/string\u003e\n        \u003cnumber key=\"distance\"\u003e322\u003c/number\u003e\n      \u003c/map\u003e\n      \u003cmap\u003e\n        \u003cstring key=\"to\"\u003eParis\u003c/string\u003e\n        \u003cnumber key=\"distance\"\u003e344\u003c/number\u003e\n      \u003c/map\u003e\n      \u003cmap\u003e\n        \u003cstring key=\"to\"\u003eAmsterdam\u003c/string\u003e\n        \u003cnumber key=\"distance\"\u003e358\u003c/number\u003e\n      \u003c/map\u003e\n    \u003c/array\u003e\n    \u003carray key=\"Paris\"\u003e\n      \u003cmap\u003e\n        \u003cstring key=\"to\"\u003eBrussels\u003c/string\u003e\n        \u003cnumber key=\"distance\"\u003e265\u003c/number\u003e\n      \u003c/map\u003e\n      \u003cmap\u003e\n        \u003cstring key=\"to\"\u003eLondon\u003c/string\u003e\n        \u003cnumber key=\"distance\"\u003e344\u003c/number\u003e\n      \u003c/map\u003e\n      \u003cmap\u003e\n        \u003cstring key=\"to\"\u003eAmsterdam\u003c/string\u003e\n        \u003cnumber key=\"distance\"\u003e431\u003c/number\u003e\n      \u003c/map\u003e\n    \u003c/array\u003e\n    \u003carray key=\"Amsterdam\"\u003e\n      \u003cmap\u003e\n        \u003cstring key=\"to\"\u003eBrussels\u003c/string\u003e\n        \u003cnumber key=\"distance\"\u003e173\u003c/number\u003e\n      \u003c/map\u003e\n      \u003cmap\u003e\n        \u003cstring key=\"to\"\u003eLondon\u003c/string\u003e\n        \u003cnumber key=\"distance\"\u003e358\u003c/number\u003e\n      \u003c/map\u003e\n      \u003cmap\u003e\n        \u003cstring key=\"to\"\u003eParis\u003c/string\u003e\n        \u003cnumber key=\"distance\"\u003e431\u003c/number\u003e\n      \u003c/map\u003e\n    \u003c/array\u003e\n  \u003c/map\u003e\n\u003c/map\u003e\n```\n\n## Dependencies\n\n* [javax.json](https://mvnrepository.com/artifact/org.glassfish/javax.json)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatomgraph%2Fjson2xml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatomgraph%2Fjson2xml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatomgraph%2Fjson2xml/lists"}