Class JsonUtils

java.lang.Object
org.gcube.common.gxrest.response.inbound.JsonUtils

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

    • JsonUtils

      public JsonUtils()
  • Method Details

    • 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 string 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 string
      Throws:
      Exception - if the deserialization fails