gistfile1.txt package com.jiabing.fastjson;import java.util.HashMap;import java.util.Map;import com.alibaba.fastjson.JSON;import com.alibaba.fastjson.JSONObject;import com.alibaba.fastjson.serializer.SerializerFeature;public class TestJson
package com.jiabing.fastjson; import java.util.HashMap; import java.util.Map; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.serializer.SerializerFeature; public class TestJson { public static void main(String[] args) { Mapmap = new HashMap (); map.put("b", "cddd"); map.put("a", "cd"); map.put("f", "cd"); map.put("d", "cd"); String ss = JSON.toJSONString(map, SerializerFeature.MapSortField); System.out.println(ss); TestBean t = new TestBean("123", "654"); String sss = JSON.toJSONString(t, SerializerFeature.MapSortField); System.out.println(sss); } }