Interface JsonSerializer

All Superinterfaces:
ObjectSerializer
All Known Subinterfaces:
JsonSerializer
All Known Implementing Classes:
GsonJsonSerializer, JacksonJsonSerializer

public interface JsonSerializer extends ObjectSerializer
Generic interface covering basic JSON serialization and deserialization methods.
  • Method Details

    • deserializeFromBytes

      default <T> T deserializeFromBytes(byte[] data, TypeReference<T> typeReference)
      Reads a JSON byte array into its object representation.
      Specified by:
      deserializeFromBytes in interface ObjectSerializer
      Type Parameters:
      T - Type of the object.
      Parameters:
      data - JSON byte array.
      typeReference - TypeReference representing the object.
      Returns:
      The object represented by the deserialized JSON byte array.
    • deserialize

      <T> T deserialize(InputStream stream, TypeReference<T> typeReference)
      Reads a JSON stream into its object representation.
      Specified by:
      deserialize in interface ObjectSerializer
      Type Parameters:
      T - Type of the object.
      Parameters:
      stream - JSON stream.
      typeReference - TypeReference representing the object.
      Returns:
      The object represented by the deserialized JSON stream.
    • deserializeFromBytesAsync

      default <T> Mono<T> deserializeFromBytesAsync(byte[] data, TypeReference<T> typeReference)
      Reads a JSON byte array into its object representation.
      Specified by:
      deserializeFromBytesAsync in interface ObjectSerializer
      Type Parameters:
      T - Type of the object.
      Parameters:
      data - JSON byte array.
      typeReference - TypeReference representing the object.
      Returns:
      Reactive stream that emits the object represented by the deserialized JSON byte array.
    • deserializeAsync

      <T> Mono<T> deserializeAsync(InputStream stream, TypeReference<T> typeReference)
      Reads a JSON stream into its object representation.
      Specified by:
      deserializeAsync in interface ObjectSerializer
      Type Parameters:
      T - Type of the object.
      Parameters:
      stream - JSON stream.
      typeReference - TypeReference representing the object.
      Returns:
      Reactive stream that emits the object represented by the deserialized JSON stream.
    • serializeToBytes

      default byte[] serializeToBytes(Object value)
      Converts the object into a JSON byte array.
      Specified by:
      serializeToBytes in interface ObjectSerializer
      Parameters:
      value - The object.
      Returns:
      The JSON binary representation of the serialized object.
    • serialize

      void serialize(OutputStream stream, Object value)
      Writes an object's JSON representation into a stream.
      Specified by:
      serialize in interface ObjectSerializer
      Parameters:
      stream - OutputStream where the object's JSON representation will be written.
      value - The object.
    • serializeToBytesAsync

      default Mono<byte[]> serializeToBytesAsync(Object value)
      Converts the object into a JSON byte array.
      Specified by:
      serializeToBytesAsync in interface ObjectSerializer
      Parameters:
      value - The object.
      Returns:
      Reactive stream that emits the JSON binary representation of the serialized object.
    • serializeAsync

      Mono<Void> serializeAsync(OutputStream stream, Object value)
      Writes an object's JSON representation into a stream.
      Specified by:
      serializeAsync in interface ObjectSerializer
      Parameters:
      stream - OutputStream where the object's JSON representation will be written.
      value - The object.
      Returns:
      Reactive stream that will indicate operation completion.