Interface JsonObject

  • All Known Implementing Classes:
    Request, Response

    @AvailableSince("3.3.0")
    public interface JsonObject
    An object that can be serialized into JSON.
    Since:
    3.3.0
    • Method Detail

      • fromInputStream

        @Nullable
        @CheckReturnValue
        @Internal
        @AvailableSince("3.3.0")
        static <T> T fromInputStream​(@NotNull
                                     @NotNull InputStream input,
                                     @NotNull
                                     @NotNull Function<@NotNull String,​@Nullable T> jsonMapper)
                              throws IOException
        Obtains a JSON object from an input stream of 0x00-terminated json strings.
        Type Parameters:
        T - the type of the POJO
        Parameters:
        input - an input stream
        jsonMapper - a function that maps a JSON string to a POJO
        Returns:
        the parsed POJO
        Throws:
        IOException - if an I/O error occurs in the input stream
        Since:
        3.3.0
      • toJSON

        @NotNull
        @CheckReturnValue
        @AvailableSince("3.3.0")
        @NotNull String toJSON()
        Converts this object to its JSON representation.
        Returns:
        JSON string
        Since:
        3.3.0