Class JsonUtils


  • public final class JsonUtils
    extends Object
    Manipulation of an GXInboundResponse's content.
    Author:
    Manuele Simi (ISTI CNR)
    • Constructor Detail

      • JsonUtils

        public JsonUtils()
    • Method Detail

      • fromJson

        public static <T> T fromJson​(byte[] bytes,
                                     Class<T> raw)
                              throws Exception
        Deserializes the specified Json bytes into an object of the specified class
        Type Parameters:
        T - the type of the desired object
        Parameters:
        bytes - the bytes from which the object is to be deserialized
        raw - the class of T
        Returns:
        an object of type T from the bytes
        Throws:
        Exception - if the deserialization fails
      • fromJson

        public static <T> T fromJson​(String json,
                                     Class<T> raw)
                              throws Exception
        Deserializes the specified Json bytes into an object of the specified class
        Type Parameters:
        T - the type of the desired object
        Parameters:
        json - the string from which the object is to be deserialized
        raw - the class of T
        Returns:
        an object of type T from the bytes
        Throws:
        Exception - if the deserialization fails