Class ConvertJson


  • public class ConvertJson
    extends Object
    • Constructor Detail

      • ConvertJson

        public ConvertJson()
    • Method Detail

      • toMap

        public static <T> Map<String,​Object> toMap​(T obj)
                                                  throws Exception
        Convert Object to Map
        Parameters:
        obj - Object
        Returns:
        Object
        Throws:
        Exception - Throw exception
      • toJson

        public static <T> String toJson​(T obj)
                                 throws Exception
        Convert Object to string JSON
        Parameters:
        obj - Object
        Returns:
        String
        Throws:
        Exception - Throw exception
      • fromJson

        public static <T> T fromJson​(Object object,
                                     Class<T> tClass)
        Convert JsonObject to Object Class
        Type Parameters:
        T - Class
        Parameters:
        object - Object
        tClass - Class
        Returns:
        Object