Json解析数据导致顺序改变问题![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/805f30ff55ae86bc465a1fb25f3ca7b9.png)
json解析的时候,通常顺序会发生改变,如果我们有保持原有顺序的需求的话可以通过如下方式
- 使用fastJson的Feature.OrderedField
JSONObject respJson = JSONObject.parseObject(jsonStr, Feature.OrderedField);
- 初始化JSONObject的时候
JSONObject(boolean ordered);
- 可以使用Google的Gson,使用gson解析的话是怎么传就是什么顺序
JsonObject jsonObject = new JsonParser().parse(jsonStr).getAsJsonObject();