Use literal JSON for constant anonymous responses
ProprietaryOpt-in default-encoder port of fresh parameterless JavaScriptSerializer.Serialize(new { ... }) responses containing only explicit ASCII property names and unescaped ASCII string, Boolean or integer literals. Fold the bounded response into a JSON string literal in property order. Leave runtime values, explicit serializer settings/resolvers and custom serializer types, other overloads, discarded comments, aliases/scoped imports, lambdas/queries, generics and snapshots for review. Remove only an unused simple serialization import. Adopts a constant response and removes serializer/anonymous-object allocations; custom ASP.NET HttpEncoder behavior and returned-string identity are not preserved. Separate from version upgrades.
OpenRewrite. Recipes. CSharp. Migration. Dotnet. Net3_0. UseLiteralJsonForConstantAnonymousResponsesmod run . --recipe= OpenRewrite. Recipes. CSharp. Migration. Dotnet. Net3_0. UseLiteralJsonForConstantAnonymousResponsesInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.