Class JsonUtils

Object
JsonUtils

public final class JsonUtils extends Object
  • Method Details

    • toJson

      public static String toJson(Object obj)
      Serialises obj with the shared ObjectMapper.
      Returns:
      JSON string (never null)
      Throws:
      RuntimeException - if Jackson fails to serialise
    • fromJson

      public static <T> T fromJson(String json, Class<T> type)
      Deserialises json into the requested type.
      Throws:
      RuntimeException - if Jackson fails to deserialise