@MindSwipe triggered the answer.
I needed to rewrite the Program.cs to:
var subclass = new Subclass
{
NaN = double.NaN // for a value like 2.3 it works without any problems
};
var serializeOptions = new JsonSerializerOptions
{
NumberHandling = JsonNumberHandling.AllowNamedFloatingPointLiterals,
//Converters = { new SubConvertor() }
};
serializeOptions.Converters.Add(new SubConvertor()); //do it like this ... even if right now I do not understand why it works.
var jsonString = JsonSerializer.Serialize(subclass, serializeOptions);