我怎么能像这样映射json:
"Fields" : [
{"name" : "someName",
"values" : [...]},
{"name" : "someName1",
"values" : [...]},
...
]
结构类似于: List< Map< String,List< String>>>
例如杰克逊映射器?
答案 0 :(得分:0)
对于Jackson,这样的数据结构将映射到您需要的json。
public class Something {
@JsonProperty
private List<Field> fields;
}
public class Field {
@JsonProperty
private String name;
@JsonProperty
private List<?> values;
}
导致
{
"fields" : [
{ "name" : "someName", "values" : [...] },
{ "name" : "someName1", "values" : [...] },
...
]
}