{"id":16859512,"url":"https://github.com/raphw/jackson-jaxb-extension","last_synced_at":"2025-09-07T06:35:37.636Z","repository":{"id":181711257,"uuid":"611689249","full_name":"raphw/jackson-jaxb-extension","owner":"raphw","description":"A Jackson extension for supporting additional JAXB annotations.","archived":false,"fork":false,"pushed_at":"2025-08-07T11:14:18.000Z","size":88,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-07T06:34:57.621Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/raphw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2023-03-09T10:46:59.000Z","updated_at":"2025-08-07T11:14:22.000Z","dependencies_parsed_at":"2025-09-07T06:34:59.889Z","dependency_job_id":null,"html_url":"https://github.com/raphw/jackson-jaxb-extension","commit_stats":null,"previous_names":["raphw/jackson-jaxb-extension"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/raphw/jackson-jaxb-extension","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphw%2Fjackson-jaxb-extension","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphw%2Fjackson-jaxb-extension/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphw%2Fjackson-jaxb-extension/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphw%2Fjackson-jaxb-extension/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raphw","download_url":"https://codeload.github.com/raphw/jackson-jaxb-extension/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphw%2Fjackson-jaxb-extension/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274005333,"owners_count":25205934,"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-09-07T02:00:09.463Z","response_time":67,"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":[],"created_at":"2024-10-13T14:18:05.008Z","updated_at":"2025-09-07T06:35:37.623Z","avatar_url":"https://github.com/raphw.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"Extensions for JAXB when using Jackson\n===\n\nThis library offers two extensions for Jackson's support of the official JAXB annotations. This is to create more consistent XML or JSON, what currently relies to some degree on the configuration of XJB and of custom configurations set in Jackson. This library contains a version for both the *javax* and *jakarta* namespace of JAXB.\n\n`XmlElementWrapper`\n====\n\n`XmlElementWrapperModule` offers support for the `XmlElementWrapper` annotation when for example the XEW plugin is used for creating object representations. The annotation allows to avoid intermediate objects for wrapped lists of elements. For example, the following class would create an XML where a list of `value` elements is wrapped by a `values` tag. \n\n    class WithXewPlugin {\n        @XmlElement(name = \"value\")\n        @XmlElementWrapper(name = \"values\")\n        List\u003cString\u003e value = new ArrayList\u003c\u003e();\n    }\n\nWithout a plugin like XEW, two classes would be created where the outer class defines the wrapper element:\n\n    class WithoutXewPlugin {\n        @XmlElement(name = \"values\")\n        Values values;\n    }\n\n    class Values {\n        @XmlElement(name = \"value\")\n        List\u003cString\u003e value = new ArrayList\u003c\u003e();\n    }\n\nDepending on the chosen representation, Jackson would then render two different JSON representations for both object representations:\n\n    {\"value\": [\"first\", \"second\"]}\n    {\"values\": {\"value\": [\"first\", \"second\"]}}\n\nJackson cannot marshal or unmarshal these representation to each other, despite the JAXB specification defining them to represent an identical structure. With the `XmlElementWrapperModule`, this capability is added to Jackson. The module allows to disable wrapping for serialization and deserialization selectively.\n\n`XmlSeeAlso`\n====\n\nThe XML standard defines a mechanism to represent polymorphic types which is not present in JSON. The `XmlSeeAlso` annotation is however not supported by Jackson where this support can be added by registering the `XmlSeeAlsoModule`. \n\nConsidering the following structure, any object of `base` could be of either type `First` or `Second`.\n\n    class Wrapper {\n        @XmlElement(name = \"base\")\n        Base base = new First();\n    }\n\n    @XmlSeeAlso({First.class, Second.class})\n    abstract class Base { }\n\n    @XmlType(name = \"FirstType\")\n    class First extends Base { }\n\n    @XmlType(name = \"SecondType\")\n    class Second extends Base { }\n\nJackson's serialization format does however not preserve the type information such that a receiver of the object cannot know that the object would be of type `First`:\n\n    {\"base\": {}}\n\nBy adding a Jackson module `XmlSeeAlsoModule.ofAtType()`, the type information is added to the XML as follows:\n\n    {\"base\": {\"@type\": \"FirstType\"}}\n\nThe same module must be registered with the reading mapper. The `@type` element is already a Jackson convention for preserving polymorphism in JSON. The *@* character is however not allowed in XML where the information should be added as an attribute of the XSI namespace by `XmlSeeAlsoModule.ofXsi()` which would result in an XML representation as the following:\n\n    \u003cwrapper\u003e\n      \u003cbase xsi:type=\"FirstType\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"/\u003e\n    \u003c/wrapper\u003e\n\nThis representation is also understood by any compliant `JAXBContext` implementation.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraphw%2Fjackson-jaxb-extension","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraphw%2Fjackson-jaxb-extension","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraphw%2Fjackson-jaxb-extension/lists"}