public static String toJSONStringIgnoreTransient(Object object) { SerializeWriter out = new SerializeWriter(); try { JSONSerializer serializer = new JSONSerializer(out); serializer.config(SerializerFeature.SkipTransientField,false); serializer.write(object); return out.toString(); } finally { out.close(); } }
Google 和 百度了好久都没有找到的答案,为以后需要的同学看