io.alauda.util.JacksonUtil Maven / Gradle / Ivy
package io.alauda.util;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
public class JacksonUtil {
private static ObjectMapper mapper = new ObjectMapper();
// Convert Object to String
public static String bean2Json(Object obj) throws IOException {
return mapper.writeValueAsString(obj);
}
// Convert string to simple Object
public static T json2Bean(String jsonStr, Class objClass)
throws IOException {
return mapper.readValue(jsonStr, objClass);
}
// Convert string to List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy