Package com.azure.core.util.serializer
Interface JsonSerializer
- All Superinterfaces:
ObjectSerializer
Generic interface covering basic JSON serialization and deserialization methods.
-
Method Summary
Modifier and TypeMethodDescription<T> Tdeserialize(InputStream stream, TypeReference<T> typeReference) Reads a JSON stream into its object representation.<T> Mono<T> deserializeAsync(InputStream stream, TypeReference<T> typeReference) Reads a JSON stream into its object representation.default <T> TdeserializeFromBytes(byte[] data, TypeReference<T> typeReference) Reads a JSON byte array into its object representation.default <T> Mono<T> deserializeFromBytesAsync(byte[] data, TypeReference<T> typeReference) Reads a JSON byte array into its object representation.voidserialize(OutputStream stream, Object value) Writes an object's JSON representation into a stream.serializeAsync(OutputStream stream, Object value) Writes an object's JSON representation into a stream.default byte[]serializeToBytes(Object value) Converts the object into a JSON byte array.default Mono<byte[]> serializeToBytesAsync(Object value) Converts the object into a JSON byte array.
-
Method Details
-
deserializeFromBytes
Reads a JSON byte array into its object representation.- Specified by:
deserializeFromBytesin interfaceObjectSerializer- Type Parameters:
T- Type of the object.- Parameters:
data- JSON byte array.typeReference-TypeReferencerepresenting the object.- Returns:
- The object represented by the deserialized JSON byte array.
-
deserialize
Reads a JSON stream into its object representation.- Specified by:
deserializein interfaceObjectSerializer- Type Parameters:
T- Type of the object.- Parameters:
stream- JSON stream.typeReference-TypeReferencerepresenting the object.- Returns:
- The object represented by the deserialized JSON stream.
-
deserializeFromBytesAsync
Reads a JSON byte array into its object representation.- Specified by:
deserializeFromBytesAsyncin interfaceObjectSerializer- Type Parameters:
T- Type of the object.- Parameters:
data- JSON byte array.typeReference-TypeReferencerepresenting the object.- Returns:
- Reactive stream that emits the object represented by the deserialized JSON byte array.
-
deserializeAsync
Reads a JSON stream into its object representation.- Specified by:
deserializeAsyncin interfaceObjectSerializer- Type Parameters:
T- Type of the object.- Parameters:
stream- JSON stream.typeReference-TypeReferencerepresenting the object.- Returns:
- Reactive stream that emits the object represented by the deserialized JSON stream.
-
serializeToBytes
Converts the object into a JSON byte array.- Specified by:
serializeToBytesin interfaceObjectSerializer- Parameters:
value- The object.- Returns:
- The JSON binary representation of the serialized object.
-
serialize
Writes an object's JSON representation into a stream.- Specified by:
serializein interfaceObjectSerializer- Parameters:
stream-OutputStreamwhere the object's JSON representation will be written.value- The object.
-
serializeToBytesAsync
Converts the object into a JSON byte array.- Specified by:
serializeToBytesAsyncin interfaceObjectSerializer- Parameters:
value- The object.- Returns:
- Reactive stream that emits the JSON binary representation of the serialized object.
-
serializeAsync
Writes an object's JSON representation into a stream.- Specified by:
serializeAsyncin interfaceObjectSerializer- Parameters:
stream-OutputStreamwhere the object's JSON representation will be written.value- The object.- Returns:
- Reactive stream that will indicate operation completion.
-