码迷,mamicode.com
首页 > Web开发 > 详细

将对象转化成json字符串

时间:2016-09-13 13:33:11      阅读:113      评论:0      收藏:0      [点我收藏+]

标签:

public static String getObjectString(Object object){
        String ObjectString = null;
        try {
            ObjectMapper objectMapper = new ObjectMapper();
            ObjectString = objectMapper.writeValueAsString(object);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        
        //调试时暂时不加密
        /*if(ObjectString != null){
            ObjectString = AESManager.parseByte2HexStr(AESManager.encrypt(ObjectString, AESManager.password));
        }*/
        return ObjectString;
        
    }

 

将对象转化成json字符串

标签:

原文地址:http://www.cnblogs.com/yzwhykd/p/5868045.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!