AI OnAI Off
You should not set globally. You can set the json options per assembly which wont affect other parts of the cms.
services.UseSystemTextJsonSerialization(typeof (MyTypeInWebProject).Assembly, (Action<JsonSerializerOptions>) (settings =>
{
settings.PropertyNamingPolicy = (JsonNamingPolicy) null;
}));
When migrating a project to CMS 12 we added the following in ConfigureServices to make our apis behave as in .NET 11
I though everything worked fine until i went to edit a content type (/EPiServer/EPiServer.Cms.UI.Admin/default#/ContentTypes/edit-content-type/<typeid>) which called the api /EPiServer/EPiServer.Cms.UI.Admin/AllowedTypes.
The calling javscript (/EPiServer/EPiServer.Cms.UI.Admin/12.25.1/clientResources/dist/admin.bundle.js) threw an exception because it was expecting the json returned to be in camel case but instead got pascal case.
This is so far the only requst that seem to fail because of this. Other optimizely admin requests seems to work either because they return camel case even thought this setting is in place or they can handle pascal case.
We can of course solve this problem by switching to camel case as a default naming policy and adjust our internal apis but i think the choice of naming policy shouldn't be determined by optimizely. Their api's should specify camel case directly with JsonPropertyNames or similar.