首页 > 代码库 > 将对象转化成json字符串

将对象转化成json字符串

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字符串