FastJson2 实现类似 Jackson 的 JsonAnyGetter 注解功能
直接上代码
@Data
private static final class Cookie {
private String path;
private String domain;
@JSONField(name = "max-age")
private String maxAge;
private String expires;
@JSONField(unwrapped = true, serialize = false, deserialize = false)
private Map<String, Object> cookies = new HashMap<>();
}
关键在于这个@JSONField(unwrapped = true, serialize = false, deserialize = false)