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)

posted @ 2024-05-01 17:06  博麗靈夢  阅读(52)  评论(0编辑  收藏  举报