package com.cku.logUtil; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; public class JSONObjectUtils { public static ObjectMapper objectMapper = new ObjectMapper(); public static String toJsonString(Object object) { if (object == null) { return "null"; } try { return objectMapper.writeValueAsString(object); } catch (JsonProcessingException e) { throw new RuntimeException(e); } } }