{"id":33919233,"url":"https://github.com/mabackma/json_to_xml","last_synced_at":"2026-04-05T11:32:46.362Z","repository":{"id":324138361,"uuid":"1095388177","full_name":"mabackma/json_to_xml","owner":"mabackma","description":"Rust tool for converting JSON to XML.","archived":false,"fork":false,"pushed_at":"2025-11-19T09:39:59.000Z","size":102,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-12-13T15:00:00.804Z","etag":null,"topics":["formatting-data","json","xml"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/mabackma.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-13T01:35:05.000Z","updated_at":"2025-11-19T09:40:02.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/mabackma/json_to_xml","commit_stats":null,"previous_names":["mabackma/json_to_xml"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mabackma/json_to_xml","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mabackma%2Fjson_to_xml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mabackma%2Fjson_to_xml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mabackma%2Fjson_to_xml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mabackma%2Fjson_to_xml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mabackma","download_url":"https://codeload.github.com/mabackma/json_to_xml/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mabackma%2Fjson_to_xml/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31434624,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T08:13:15.228Z","status":"ssl_error","status_checked_at":"2026-04-05T08:13:11.839Z","response_time":75,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["formatting-data","json","xml"],"created_at":"2025-12-12T08:44:50.164Z","updated_at":"2026-04-05T11:32:46.352Z","avatar_url":"https://github.com/mabackma.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JSON to XML\n\n[Crate](https://crates.io/crates/json_to_xml)\n\n[Documentation](https://docs.rs/json_to_xml/0.1.8/json_to_xml/)\n\n## Convert JSON to XML with a default \"Root\" element.\n\nThis is a convenience function that calls `json_to_xml_with_root` with \"Root\" as the default root element name.\n\n## Example 1\n\n```rust\nuse json_to_xml::generate_xml::json_to_xml;\n\nlet json_string = r#\"\n{\n    \"@library\": \"lib1\",\n    \"book\": {\n        \"@isbn\": \"978-3-16-148410-0\",\n        \"title\": \"The Rust Programming Language\",\n        \"author\": \"Steve Klabnik and Carol Nichols\"\n    }\n}\n\"#;\n\nlet xml_string = json_to_xml(\u0026json_string).unwrap();\n\nprintln!(\"{}\", xml_string);\n```\n\n## Expected Output (XML):\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003c!--Generated with json_to_xml 0.1.7--\u003e\n\u003cRoot library=\"lib1\"\u003e\n  \u003cBook isbn=\"978-3-16-148410-0\"\u003e\n    \u003cAuthor\u003eSteve Klabnik and Carol Nichols\u003c/Author\u003e\n    \u003cTitle\u003eThe Rust Programming Language\u003c/Title\u003e\n  \u003c/Book\u003e\n\u003c/Root\u003e\n```\n\n## Example 2\n\n```rust\nuse json_to_xml::generate_xml::json_to_xml;\n\nlet json_string = r#\"\n{\n    \"book\": {\n        \"@isbn\": \"978-3-16-148410-0\",\n        \"title\": \"The Rust Programming Language\",\n        \"author\": \"Steve Klabnik and Carol Nichols\"\n    }\n}\n\"#;\n\nlet xml_string = json_to_xml(\u0026json_string).unwrap();\n\nprintln!(\"{}\", xml_string);\n```\n\n## Expected Output (XML):\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003c!--Generated with json_to_xml 0.1.7--\u003e\n\u003cBook isbn=\"978-3-16-148410-0\"\u003e\n  \u003cAuthor\u003eSteve Klabnik and Carol Nichols\u003c/Author\u003e\n  \u003cTitle\u003eThe Rust Programming Language\u003c/Title\u003e\n\u003c/Book\u003e\n```\n\n## Convert JSON to XML with a custom root element.\n\nThis function takes a JSON string and a specified root element name and converts it into an XML string.\nIt processes JSON objects, arrays, and primitive values recursively.\nAttributes in JSON (prefixed with `@`) are converted to XML attributes.\nAll XML tags are capitalized.\n\n## Example\n\n```rust\nuse json_to_xml::generate_xml::json_to_xml_with_root;\n\nlet json_string = r#\"\n{\n    \"@xmlns:addr\": \"http://standards.fi/schemas/personData/addresses\",\n    \"@xmlns:pr\": \"http://standards.fi/schemas/personData/person\",\n    \"person\": {\n        \"name\": \"John Doe\",\n        \"age\": \"30\",\n        \"@id\": \"1234\",\n        \"addresses\": [\n            {\n                \"street\": \"123 Main St\",\n                \"city\": \"Springfield\",\n                \"@type\": \"primary\"\n            },\n            {\n                \"street\": \"456 Oak Ave\",\n                \"city\": \"Shelbyville\",\n                \"@type\": \"secondary\"\n            }\n        ]\n    }\n}\n\"#;\n\nlet xml_string = json_to_xml_with_root(\u0026json_string, \"People\").unwrap();\n\nprintln!(\"{}\", xml_string);\n```\n\n## Expected Output (XML):\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003c!--Generated with json_to_xml 0.1.7--\u003e\n\u003cPeople xmlns:pr=\"http://standards.fi/schemas/personData/person\" xmlns:addr=\"http://standards.fi/schemas/personData/addresses\"\u003e\n  \u003cPerson id=\"1234\"\u003e\n    \u003cAddresses type=\"primary\"\u003e\n      \u003cCity\u003eSpringfield\u003c/City\u003e\n      \u003cStreet\u003e123 Main St\u003c/Street\u003e\n    \u003c/Addresses\u003e\n    \u003cAddresses type=\"secondary\"\u003e\n      \u003cCity\u003eShelbyville\u003c/City\u003e\n      \u003cStreet\u003e456 Oak Ave\u003c/Street\u003e\n    \u003c/Addresses\u003e\n    \u003cAge\u003e30\u003c/Age\u003e\n    \u003cName\u003eJohn Doe\u003c/Name\u003e\n  \u003c/Person\u003e\n\u003c/People\u003e\n```\n\n## Parameters:\n- `json_string`: The input JSON string to be converted into XML.\n- `root`: The name for the root element of the XML. It will become the root element of the XML if the JSON contains top-level @ attributes.\n\n## Returns:\nA `Result` which is either a `String` containing the XML representation of the input JSON, or a `ConversionError` if parsing or conversion fails.\n\n## Notes:\n- This function works recursively to handle nested structures and arrays.\n- JSON keys starting with `@` are treated as attributes for the parent XML element.\n- All XML element tags are automatically capitalized.\n- Empty JSON objects (`{}`) are converted into self-closing tags (e.g., `\u003cTag/\u003e`).\n- Empty JSON arrays (`[]`) are converted into an empty element (e.g., `\u003cTag\u003e\u003c/Tag\u003e`).\n- `null` values in JSON are converted into a self-closing `\u003cNone/\u003e` tag.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmabackma%2Fjson_to_xml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmabackma%2Fjson_to_xml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmabackma%2Fjson_to_xml/lists"}