Class JsonHelper


  • public final class JsonHelper
    extends Object
    The JsonHelper class is used to convert object from and to JSON.
    • Constructor Detail

      • JsonHelper

        public JsonHelper()
    • Method Detail

      • toJson

        public static String toJson​(Object object)
        Converts the specified object to a JSON string.
        Parameters:
        object - the object to convert
        Returns:
        a JSON string representing the object
      • fromJson

        public static <T> T fromJson​(String json,
                                     Class<T> clazz)
        Converts a JSON string to an object.
        Type Parameters:
        T - the type of the object
        Parameters:
        json - the JSON string to convert
        clazz - the class of the object
        Returns:
        an object represented by the JSON string