com.github.wanggit.access.frequency.utils.JsonUtils Maven / Gradle / Ivy
package com.github.wanggit.access.frequency.utils;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
public class JsonUtils {
public static String toJson(Object javaObj){
try {
ObjectMapper mapper = new ObjectMapper();
return mapper.writeValueAsString(javaObj);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
return null;
}
}