在fastjson-1.1.34.jar版本中使用new JSONObject();在put数据后生成字符串时,发现key未按照put顺序排列,经查资料,升级到最新版本(fastjson-1.2.79.jar)后使用如下方法可以正常排序;
JSONObject s=new JSONObject(true);
下载地址:https://download.csdn.net/download/chenanmuyu/69626164或者https://search.maven.org/remote_content?g=com.alibaba&a=fastjson&v=LATEST