All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.litongjava.utils.json.JacksonUtils Maven / Gradle / Ivy

There is a newer version: 1.1.0
Show newest version
package com.litongjava.utils.json;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * @author litong
 * jackson utils
 */
public class JacksonUtils {
  private static final ObjectMapper objMapper = new ObjectMapper();

  public static String toJson(Object obj) {
    try {
      return objMapper.writeValueAsString(obj);
    } catch (JsonProcessingException e) {
      e.printStackTrace();
    }
    return null;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy