1. 解决因$ref引用所发生的异常问题:
JSONObject.toJSONString(result,SerializerFeature.DisableCircularReferenceDetect);
2.解决日期格式化问题,从long转date
JSONObject.toJSONString(result,SerializerFeature.WriteDateUseDateFormat);
3.由于该接口原型如下:
public static final String toJSONString(Object object, SerializerFeature... features)
最后参数为数组类型,所以可以在多个参数一起传进:
JSONObject.toJSONString(result,SerializerFeature.DisableCircularReferenceDetect, SerializerFeature.WriteDateUseDateFormat);
,