I have a text file 'input.txt' which contains this text
{
"product" : {
"name" : "Pro-1",
"category" : "A"
}
}
and a class
public class Product {
@JsonProperty("name")
public String name;
@JsonProperty("category")
public String category
...
...
}
I am using Jackson
Product p = mapper.readValue(new File("input.txt"), Product.class);
My class has no attribute named "product" and as a result exception occurs when mapping the json text to the product object. So, what will be a proper way ignore this "product" attribute when mapping to Product object from the text file?