setSerializer

inline fun <T> Json.setSerializer(serializer: Json.Serializer<T>)

Registers a serializer to use for type T instead of the default behavior of serializing all of an object fields.