{"id":23289811,"url":"https://github.com/devdevx/jackson-examples","last_synced_at":"2026-04-16T02:32:32.692Z","repository":{"id":63001494,"uuid":"148069450","full_name":"devdevx/jackson-examples","owner":"devdevx","description":null,"archived":false,"fork":false,"pushed_at":"2019-03-24T18:17:48.000Z","size":62,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-16T00:09:12.343Z","etag":null,"topics":["demo","examples","jackson","java","java-8","java-8-time-api","joda-time","json"],"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/devdevx.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}},"created_at":"2018-09-09T22:03:01.000Z","updated_at":"2019-03-24T18:17:49.000Z","dependencies_parsed_at":"2022-11-10T17:30:25.619Z","dependency_job_id":null,"html_url":"https://github.com/devdevx/jackson-examples","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/devdevx/jackson-examples","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devdevx%2Fjackson-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devdevx%2Fjackson-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devdevx%2Fjackson-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devdevx%2Fjackson-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devdevx","download_url":"https://codeload.github.com/devdevx/jackson-examples/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devdevx%2Fjackson-examples/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31868508,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"online","status_checked_at":"2026-04-16T02:00:06.042Z","response_time":69,"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":["demo","examples","jackson","java","java-8","java-8-time-api","joda-time","json"],"created_at":"2024-12-20T04:18:29.964Z","updated_at":"2026-04-16T02:32:32.672Z","avatar_url":"https://github.com/devdevx.png","language":"Java","readme":"# Introduction\n\nThis project contains multiple examples using the jackson annotations for parsing java objects to json.\n\nEach example contains the definition of the java class and a test where the object is converted to json and vice versa. \n\n# Examples\n\n## Simple\n\nSimple example with no annotations.\n\nJackson needs an empty constructor.\n\nThe methods (getters, setters, etc) and the empty constructor used by jackson can have any visibility (private, package, protected and public).\n\n## One-way\n\nExample that shows how to define a one way serialization.\n\n## Ignore\n\nExample that shows how to ignore a property during.\n\n## Rename\n\nExample that shows how to rename a property during serialization, deserialization or both.\n\n**IMPORTANT** The annotation `@JsonGetter` allow us to rename a field for the serialization, it requires a `@JsonSetter` for the same field, otherwise the name is changed in bot, serialization and deserialization.\n\n## Cyclic\n\nExample that shows how to avoid cyclic serialization issues.\n\n## Cyclic with owner\n\nExample that shows how to avoid cyclic serialization issues when we are serializing/deserializing a set of objects with an owner part.\n\n## Dynamic attributes\n\nExample that shows how to serialize and deserialize dynamic attributes. \n\n## Raw value\n\nExample that shows how to serialize objects that contains json attributes in `String` fields.\n\n**IMPORTANT** The annotation `@JsonRawValue` is only for serialization (object to json), if we need the opposite we can use the `@JsonProperty` in a setter method.\n\n## Root\n\nExample that shows how to add another level in the json with the name of the root class when serializing.\n\n**IMPORTANT** To achieve this functionality, we need to enable the options in te `ObjectMapper` instance (`WRAP_ROOT_VALUE` and `UNWRAP_ROOT_VALUE`).\n\n## Polymorphism\n\nExample that shows how to serialize and deserialize objects with multiple levels of polymorphism.\n\nMultiple fields for type are not supported.\n\n**IMPORTANT** Whe need to define the type of the parent class in both places when multiple levels are defined. \n\n## Flat\n\nExample that shows how to serialize and deserialize objects with nested objects to flat json.\n\n**IMPORTANT** The prefix and suffix don't do any capitalization to the names.\n\n## Java Time\n\nExample that shows how to serialize and deserialize the classes of the `java.time` library, it shows how to use the default formats and custom formats.\n\n**IMPORTANT** We need to register the `JavaTimeModule` in the `ObjectMapper` instance. Additionally, we need to disable the property `WRITE_DATES_AS_TIMESTAMPS` to disable the conversion of the objects to milliseconds.\n\n## Joda Time\n\nExample that shows how to serialize and deserialize the classes of the `joda.time` library, it shows how to use the default formats and custom formats.\n\n**IMPORTANT** We need to register the `JodaTimeModule` in the `ObjectMapper` instance. Additionally, we need to disable the property `WRITE_DATES_AS_TIMESTAMPS` to disable the conversion of the objects to milliseconds.\n\n**VERY IMPORTANT** Note that from Java SE 8 onwards, users are asked to migrate to `java.time` (JSR-310) - a core part of the JDK which replaces [Joda-Time](http://www.joda.org/joda-time/)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevdevx%2Fjackson-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevdevx%2Fjackson-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevdevx%2Fjackson-examples/lists"}