I use JAVA jackson to mapping JSON to JAVA pojo objects, my JSON file is:
[
[
{
"name": "tetragrammatonList_stocks_headerColumn_amountStoreOther",
"id": "amountStoreOther"
},
{
"name": "tetragrammatonList_stocks_headerColumn_article.articleSubGroup.name",
"id": "article.articleSubGroup.name"
},
.....
{
"name": "tetragrammatonList_stocks_headerColumn_article.producer.name",
"id": "article.producer.name"
}
],
[
{
"name": "tetragrammatonList_stocks_headerColumn_articleEANs",
"id": "articleEANs"
},
{
"name": "tetragrammatonList_stocks_headerColumn_article.plu",
"id": "article.plu"
},
{
"name": "tetragrammatonList_stocks_headerColumn_article.name",
"id": "article.name"
},
.....
{
"name": "tetragrammatonList_stocks_headerColumn_article.producer.name",
"id": "article.producer.name"
}
]
]
and after readValue
I have this error message:
Cannot deserialize instance of ....
out of START_ARRAY token
my POJO classes:
public class A
{
private String name;
private String id;
+get/set methods
}
public class B
{
private String name;
private String id;
+get/set methods
}
public class Root
{
private List<A> a;
private List<B> b;
+get/set methods
}
Root root = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false).readValue(jsonString, Root.class);
please, what are correct java pojos for this JSON format ? thanks.