使用com.alibaba.fastjson.JSONObject
JSONObject jsonObject =JSONObject.parseObject(jsonStr);
转json转换之前顺序是对的,使用JSONObject 之后顺序完全变了,不是自己想要的效果
解决方法:使用com.alibaba.fastjson.parser.Feature的枚举,里面有一个叫OrderedField的枚举
JSONObject jsonObject =JSONObject.parseObject(jsonStr,Feature.OrderedField);
顺序就变成有序了,问题解决