Keeping System.Text.Json lean
The System.Text.Json serializer has an unexpected performance penalty when used with options
![](https://blog.fractalia.se/img/2020/09//marc-olivier-jodoin-NqOInJ-ttqM-unsplash.jpg)
Serialization with System.Text.Json
has an unexpected performance penalty when used with options, such as setting the PropertyNamingPolicy to CamelCase. For small objects, serialization is ~200x slower! To avoid this issue, store the options object in a class member and pass that member to JsonSerializer.Serialize.