Skip to content

Instantly share code, notes, and snippets.

@Gogetter
Created April 2, 2022 11:56
Show Gist options
  • Save Gogetter/1195f87c5f75c9d299c1ee97b0ace9d2 to your computer and use it in GitHub Desktop.
Save Gogetter/1195f87c5f75c9d299c1ee97b0ace9d2 to your computer and use it in GitHub Desktop.
@JsonIgnoreProperties(ignoreUnknown = true)
public record Person(
@JsonProperty("gender") String gender,
@JsonProperty("name") Name fullName,
@JsonProperty("email") String email) {
public static Person from(Map<String, Object> personMap) {
return new ObjectMapper().convertValue(personMap, Person.class);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment