skip to Main Content

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

C# LINQ to select element from string array – Asp.net

I have a string: private const string Codes = "2,10"; public void method() { var displayCodes = Codes.Split(','); DemoResponse response = webService.GetResponse(); //getting response from API if(response.Errors.Any(x => displayCodes.Contains(x.StackTrace)) { int myCode = int.Parse(response.Errors.Select(x => x.StackTrace).FirstOrDefault()); } } This is…

VIEW QUESTION
Back To Top
Search