Open Zane-XY opened 6 years ago
在enum上的 @JSONField 在parse的时候起到了作用,但是在toString的时候,并没有使用name中指定的key, 仍然打印出 "type":"enumeration", 期望的是 "type":"enum"。
public class AttributeTypeDesc { private AttributeType type; /* setter getter */ } enum AttributeType { number, string, @JSONField(name = "enum") enumeration; } AttributeTypeDesc typeEnum = JSON.parseObject("{\"type\":\"enum\"}", AttributeTypeDesc .class); JSON.toJSONString(typeEnum)
这个不支持哦
This feature would be really nice to have.
Actually, this feature seems to be supported in recent versions. :tada:
在enum上的 @JSONField 在parse的时候起到了作用,但是在toString的时候,并没有使用name中指定的key, 仍然打印出 "type":"enumeration", 期望的是 "type":"enum"。