fastjson之serializer.SerializerFeature

SerializerFeature 参考
http://blog.csdn.net/u010246789/article/details/52539576
http://www.cnblogs.com/deepbreath/p/5443665.html

SerializerFeature.DisableCircularReferenceDetect
消除对同一对象循环引用的问题,默认为false

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;

public void test()  {
    /*1.从数据库获取操作日志列表,分页返回  reloadLogData()自定义的方法*/
    Page<OperateLog> operateLog = reloadLogData();
    /*2.SerializerFeature.DisableCircularReferenceDetect消除对同一对象循环引用的问题,默认为false*/
    /*3.toJSONString()将JavaBean序列化为JSON文本 */
    JSON.toJSONString(operateLog,SerializerFeature.DisableCircularReferenceDetect);
}
posted on 2017-04-24 11:32  dreamstar  阅读(136)  评论(0编辑  收藏  举报