{"id":24295286,"url":"https://github.com/basemax/json-to-xml-converter","last_synced_at":"2026-04-25T11:31:57.115Z","repository":{"id":272332886,"uuid":"915067120","full_name":"BaseMax/json-to-xml-converter","owner":"BaseMax","description":"`json-to-xml-converter` is a simple Python library for converting JSON data to XML and vice versa. It allows you to easily convert JSON files to XML format or XML files to JSON format using command-line arguments.","archived":false,"fork":false,"pushed_at":"2025-01-13T18:09:25.000Z","size":21,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-26T05:55:48.190Z","etag":null,"topics":["converter","convertor","convertor-utils","json","json-to-xml","json2xml","py","python","python-json","python-xml","python3","xml","xml-to-json"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BaseMax.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2025-01-10T22:26:09.000Z","updated_at":"2025-01-14T03:12:55.000Z","dependencies_parsed_at":"2025-01-13T19:24:41.901Z","dependency_job_id":"30c60342-f0d8-47f6-9eea-ef956de8a321","html_url":"https://github.com/BaseMax/json-to-xml-converter","commit_stats":null,"previous_names":["basemax/json-to-xml-converter"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2Fjson-to-xml-converter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2Fjson-to-xml-converter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2Fjson-to-xml-converter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaseMax%2Fjson-to-xml-converter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BaseMax","download_url":"https://codeload.github.com/BaseMax/json-to-xml-converter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242163854,"owners_count":20082224,"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","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","convertor","convertor-utils","json","json-to-xml","json2xml","py","python","python-json","python-xml","python3","xml","xml-to-json"],"created_at":"2025-01-16T18:39:47.493Z","updated_at":"2026-04-25T11:31:57.075Z","avatar_url":"https://github.com/BaseMax.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JSON to XML Converter\n\n`json-to-xml-converter` is a simple Python library for converting JSON data to XML and vice versa. It allows you to easily convert JSON files to XML format or XML files to JSON format using command-line arguments.\n\n## Features\n- Converts JSON to XML with customizable root element.\n- Converts XML to JSON while handling nested elements and arrays.\n- Command-line utility for easy conversion of files.\n- Supports both Python scripts and command-line execution.\n\n## Installation\n\nTo use `json-to-xml-converter`, you need Python 3 installed. Clone this repository to your local machine:\n\n```bash\ngit clone https://github.com/BaseMax/json-to-xml-converter.git\ncd json-to-xml-converter\n```\n\n### Install dependencies:\n\n```bash\npip install -r requirements.txt\n```\n\n## Usage\n\n### Command-Line Usage\n\nYou can run the converter directly from the command line:\n\n```bash\npython converter.py --json-to-xml --input input.json --output output.xml\n```\n\nThis converts a JSON file to XML. To convert XML to JSON, use:\n\n```bash\npython converter.py --xml-to-json --input input.xml --output output.json\n```\n\nFor example:\n\n```bash\n$ python converter.py --json-to-xml --input input.json --output output.xml\nConverted JSON to XML and saved to output.xml\n```\n\n#### Options:\n- `--json-to-xml`: Convert JSON to XML.\n- `--xml-to-json`: Convert XML to JSON.\n- `--input`: Path to the input file (either `.json` or `.xml`).\n- `--output`: Path to the output file (either `.xml` or `.json`).\n- `--root`: Name of the root element for XML (optional, default is \"root\").\n- `--version`: Display the version of the converter.\n\n### Example Usage in Python\n\nYou can also import the library functions directly into your Python code for more control over the conversion:\n\n```python\nimport json\nfrom converter import json_to_xml, xml_to_json\n\n# Example JSON to XML conversion\njson_data = {\n    \"person\": {\n        \"name\": \"John Doe\",\n        \"age\": 30,\n        \"hobbies\": [\"reading\", \"cycling\", \"hiking\"]\n    }\n}\nxml_output = json_to_xml(json_data, root_name=\"data\")\nprint(\"XML Output:\\n\", xml_output)\n\n# Example XML to JSON conversion\nxml_data = '''\n\u003cdata\u003e\n    \u003cperson\u003e\n        \u003cname\u003eJohn Doe\u003c/name\u003e\n        \u003cage\u003e30\u003c/age\u003e\n        \u003chobbies\u003e\n            \u003citem\u003ereading\u003c/item\u003e\n            \u003citem\u003ecycling\u003c/item\u003e\n            \u003citem\u003ehiking\u003c/item\u003e\n        \u003c/hobbies\u003e\n    \u003c/person\u003e\n\u003c/data\u003e\n'''\njson_output = xml_to_json(xml_data)\nprint(\"JSON Output:\\n\", json.dumps(json_output, indent=4))\n```\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Contributions\n\nFeel free to fork, submit issues, and create pull requests. Contributions are welcome!\n\n## Copyright\n\n2025 Max Base\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasemax%2Fjson-to-xml-converter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbasemax%2Fjson-to-xml-converter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasemax%2Fjson-to-xml-converter/lists"}