Port flat string JSON responses with HttpUtility encoding

Proprietary

Opt-in default-encoder/declaration-order port of fresh parameterless JavaScriptSerializer.Serialize calls on flat anonymous objects with explicit ASCII property names and resolved string values. Capture values once in order in a private helper, retain null/string JSON representation with HttpUtility.JavaScriptStringEncode, and enforce the default MaxJsonLength with InvalidOperationException and its English message. Assume default Framework HttpEncoder; custom encoder configuration, localization, reflection property order and allocation identity are not emulated. Leave configured/custom serializers, other value types/shapes/overloads, named calls, comments, aliases/scoped imports, lambdas/queries, partial/generic owners and snapshots unchanged. Separate from version upgrades; target .NET Core 3.0 or later.

OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net3_0.UseHttpUtilityForFlatStringJsonResponses
mod run . --recipe=OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net3_0.UseHttpUtilityForFlatStringJsonResponses

Install it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.