[英]Jackson deserialization into field from subnode?
I have a class 我上课了
public class Foo {
String foo;
String bar;
}
and JSON 和JSON
{
"foo": "foo",
"bar": {
"bar": "bar"
}
}
Can I deserialize it using any json library without writing adapters/serializers to specific class. 我可以使用任何json库反序列化它,而无需将适配器/序列化器写入特定类。
Maybe some of gson's adapters has needed behavior? 也许gson的某些适配器需要行为? But I didn't find adapter to field.
但是我没有找到用于现场的适配器。 I'd like to write annotation like
@MyJsonExpandAnnotation("bar.bar")
but I can't find adapter with access to Field. 我想编写诸如
@MyJsonExpandAnnotation("bar.bar")
类的注释,但找不到具有对Field的访问权限的适配器。
Basically what you would use without your given annotation example is 基本上,如果没有给定的注释示例,您将使用的是
public class Foo {
String foo;
Bar bar;
}
public class Bar{
String bar;
}
There is an open suggestion for it tho. 有一个公开的建议 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.