序列化后的以下类将创建2个键值对
public class Node {
private boolean isLeafNode = false;
public void setLeafNode(boolean isLeafNode) {
this.isLeafNode = isLeafNode;
}
@JsonProperty(value="isLeafNode")
public boolean isLeafNode() {
return isLeafNode;
}
}
序列化的输出如下。
{"isLeafNode":false,"leafNode":false}
我期望的是
{"isLeafNode":false}