0
点赞
收藏
分享

微信扫一扫

fastJson设置有序

独兜曲 2023-02-20 阅读 135


直接看构造方法,可以设置有序和无序,默认是false无序,可以设置为true为有序

private static final long serialVersionUID = 1L;
private static final int DEFAULT_INITIAL_CAPACITY = 16;
private final Map<String, Object> map;

public JSONObject() {
this(16, false);
}

public JSONObject(Map<String, Object> map) {
if (map == null) {
throw new IllegalArgumentException("map is null.");
} else {
this.map = map;
}
}

public JSONObject(boolean ordered) {
this(16, ordered);
}

有序

JSONObject jsonObject  = new JSONObject(true);


举报

相关推荐

0 条评论