Serializes the specified value using the format represented by the specified encoder.
See the KSerializer.serialize function for more details.