Reputation: 2845
I have json with following fields:
{
"id": "MSNVK13LWEWV91",
"country": "india",
"name": "cooktop test products",
"id_brand": "7fbdea31-a2bf-437b-8697-72edfb7fe673",
"product_type": "visible"
}
But i want only country and id to deserialize in spring boot with fasterxml.jackson.
Upvotes: 1
Views: 41
Reputation: 638
You can use @JsonIgnoreProperties( ignoreUnknown = true )
in you DTO:
@Data
@JsonInclude( JsonInclude.Include.NON_NULL )
@JsonIgnoreProperties( ignoreUnknown = true )
public class ProductVO
{
private String id;
@JsonProperty( "country" )
private double country;
}
Hope this will help you in spring boot.
Upvotes: 2