我正在尝试使用 ModelMapper 来映射以下 json,如此处所述http://modelmapper.org/user-manual/gson-integration/但我得到了 NullPointerException 并且我不知道出了什么问题。请问有什么提示吗?
{"a": "aaa", "b": [{"c": "ccc"}]}
public class Foo {
private String a;
private ArrayList<Bar> b;
}
public class Bar {
private String c;
}
ModelMapper mapper = new ModelMapper();
mapper.getConfiguration().addValueReader(new JsonElementValueReader());
JsonElement responseElement = new JsonParser().parse(json);
Foo foo = mapper.map(responseElement, Foo.class);