Object GsonUtils

  • All Implemented Interfaces:

    
    public class GsonUtils
    
                        
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Constructor Detail

    • Method Detail

      • fromJson

         final static <T extends Any> T fromJson(Gson $self, String json, Class<T> clazz)

        Deserializes a JSON string into the specified class

        Parameters:
        json - The JSON string to deserialize
        clazz - The class to deserialize the JSON into
        Returns:

        Deserialized JSON

      • fromJson

         final static <T extends Any> T fromJson(Gson $self, Reader reader, Class<T> clazz)

        Deserializes a JSON string into the specified class

        Parameters:
        reader - The reader from which JSON will be deserialized
        clazz - The class to deserialize the JSON into
        Returns:

        Deserialized JSON

      • fromJson

         final static <T extends Any> T fromJson(Gson $self, String json, Type type)

        Deserializes a JSON string into the specified object

        Parameters:
        json - The JSON string to deserialize
        type - The type of the object to deserialize the JSON into
        Returns:

        Deserialized JSON

      • toJson

         final static String toJson(Gson $self, Object obj)

        Serializes an Object to JSON

        Parameters:
        obj - The object to serialize
        Returns:

        Serialized JSON

      • toJsonPretty

        @Deprecated(message = "Use kt extension for Gson", replaceWith = @ReplaceWith(expression = "gsonPretty.toJson(obj)")) final static String toJsonPretty(Object obj)

        Serializes an Object to pretty printed JSON

        Parameters:
        obj - The object to serialize
        Returns:

        Serialized JSON