encodeToStream

fun <T> Json.encodeToStream(    serializer: SerializationStrategy<T>,     value: T,     stream: OutputStream)

Serializes the value with serializer into a stream using JSON format and UTF-8 encoding.

Throws

if the given value cannot be serialized to JSON.

If an I/O error occurs and stream cannot be written to.


inline fun <T> Json.encodeToStream(value: T, stream: OutputStream)

Serializes given value to stream using UTF-8 encoding and serializer retrieved from the reified type parameter.

Throws

if the given value cannot be serialized to JSON.

If an I/O error occurs and stream cannot be written to.