类 JsonUtils

java.lang.Object
com.baidu.mochow.util.JsonUtils

public class JsonUtils extends Object
JsonUtils for Serialization and deserialization of JSON
  • 构造器详细资料

    • JsonUtils

      public JsonUtils()
  • 方法详细资料

    • toJsonPrettyString

      public static String toJsonPrettyString(Object value) throws com.fasterxml.jackson.core.JsonProcessingException
      抛出:
      com.fasterxml.jackson.core.JsonProcessingException
    • toJsonString

      public static String toJsonString(Object value)
    • fromJsonString

      public static <T> T fromJsonString(String json, Class<T> clazz)
      Returns the deserialized object from the given json string and target class; or null if the given json string is null.
    • loadFrom

      public static <T> T loadFrom(File file, Class<T> clazz) throws IOException
      抛出:
      IOException
    • loadFrom

      public static <T> T loadFrom(InputStream input, Class<T> clazz) throws com.fasterxml.jackson.core.JsonParseException, com.fasterxml.jackson.databind.JsonMappingException, IOException
      抛出:
      com.fasterxml.jackson.core.JsonParseException
      com.fasterxml.jackson.databind.JsonMappingException
      IOException
    • load

      public static void load(InputStream input, Object obj) throws IOException, com.fasterxml.jackson.core.JsonProcessingException
      抛出:
      IOException
      com.fasterxml.jackson.core.JsonProcessingException
    • getObjectMapper

      public static com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()