Class Json

  • All Implemented Interfaces:

    @Deprecated() 
    public class Json
    
                        

    A utility class for JSON.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      public interface Json.JsonCodec

      The abstract JSON codec interface.

    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      static String toJson(Object o) Convert the given object to JSON.
      static <T> T fromJson(String json, Class<T> type) Convert the given JSON string to an object of the given class.
      static <T> T fromJson(String json, Type type) Convert the given JSON string to an object of the given type.
      static InputStream toInputStream(Object o, Class<out Object> type) Convert the given object to an InputStream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • toJson

        @Deprecated() static String toJson(Object o)

        Convert the given object to JSON.

        Parameters:
        o - the object to convert.
        Returns:

        the JSON string.

      • fromJson

        @Deprecated() static <T> T fromJson(String json, Class<T> type)

        Convert the given JSON string to an object of the given class.

        Parameters:
        json - the JSON string.
        type - the class of the object.
        Returns:

        the object.

      • fromJson

        @Deprecated() static <T> T fromJson(String json, Type type)

        Convert the given JSON string to an object of the given type.

        Parameters:
        json - the JSON string.
        type - the type of the object.
        Returns:

        the object.