David Jovanovski
David Jovanovski
CC#
Created by David Jovanovski on 6/13/2024 in #help
Json to enum deserialization issue
so raw json
19 replies
CC#
Created by David Jovanovski on 6/13/2024 in #help
Json to enum deserialization issue
It was done from Postman
19 replies
CC#
Created by David Jovanovski on 6/13/2024 in #help
Json to enum deserialization issue
C#
services.AddControllers().AddJsonOptions(options =>
{
options.JsonSerializerOptions.Converters.Add(new JsonPropertyNameEnumConverter(JsonNamingPolicy.CamelCase));
options.JsonSerializerOptions.Converters.Add(new DoubleConvertor());
options.JsonSerializerOptions.Converters.Add(new FloatConvertor());
options.JsonSerializerOptions.PropertyNameCaseInsensitive = true;
});
C#
services.AddControllers().AddJsonOptions(options =>
{
options.JsonSerializerOptions.Converters.Add(new JsonPropertyNameEnumConverter(JsonNamingPolicy.CamelCase));
options.JsonSerializerOptions.Converters.Add(new DoubleConvertor());
options.JsonSerializerOptions.Converters.Add(new FloatConvertor());
options.JsonSerializerOptions.PropertyNameCaseInsensitive = true;
});
19 replies
CC#
Created by David Jovanovski on 6/13/2024 in #help
Json to enum deserialization issue
as
19 replies
CC#
Created by David Jovanovski on 6/13/2024 in #help
Json to enum deserialization issue
And the same thing happens with RentalMetrics, it just takes the first enum in the in RentalMetrics enum as default instead of taking value from primaryMetric...
19 replies
CC#
Created by David Jovanovski on 6/13/2024 in #help
Json to enum deserialization issue
I am using System.Text.Json
19 replies
CC#
Created by David Jovanovski on 6/13/2024 in #help
Json to enum deserialization issue
I tried changing the both to a list but only RentalMetrics deserializes still
19 replies