skip to Main Content

Configure all options derived from base option class or interface .NET Core – Asp.net

I have code with variables in appsettings.json file so I register all options in IServiceCollection via configure method: public static void Configure(IServiceCollection services, IConfiguration configuration, bool useHangfire = true) { services .Configure<AuthSettings>(configuration.GetSection(AuthSettings.SectionName)) .Configure<CacheSettings>(configuration.GetSection(CacheSettings.SectionName)) ..... and so on I would like…

VIEW QUESTION

Force System.Text.Json to deserialize in CamelCase – Asp.net

I am trying to build a JsonElement (or similar) using a camelCase convention from a PascalCase string using System.Text.Json. Is there a way to enforce that behavior? var jsonString = "{"Property1":"s", "PropertyCamel":{"PropertyNested":"g"}, "PPP":[{"NestedList":"1"}]}"; var deserialized = System.Text.Json.JsonSerializer.Deserialize<JsonElement>(jsonString, new JsonSerializerOptions {…

VIEW QUESTION
Back To Top
Search