"Object of type RichTextValue is not JSON serializable",

Related to ‘similar questions before’:
——————

Is there a way to make a ‘serializer that works “for all” occurenceies?

It seems like I can make a serializer for a custom fields with code similart to the below:
BUT: I will still get errors if RichText is saved in registry ( related to ‘RichText in Control panel question ‘solved’ earlier). Also: restAPI searches will give error if asking for ‘metadata_field=name_of_richtext_field’

@implementer(IFieldSerializer)
@adapter(getFields(INotification)\["message"\].\__class_\_, INotification, None)
class NotificationMessagePlainTextSerializer:
def \__init_\_(self, field, context, request):
	self.field = field
	self.context = context
	self.request = request

def \__call_\_(self):
	value = self.field.get(self.context)

	if not value:
		return ""

	return html_to_text(value.output)