modern-boots-64313
04/29/2024, 8:56 AMGet
, and deserialize myself, also doesn't work
Console.WriteLine($"============== Get MetricSpecArgs JSON String via Config.Get ==============");
var jsonString = Config.Get("hpa-metrics");
Console.WriteLine($"jsonString: {jsonString}");
Console.WriteLine($"============== Try Deserialize JSON String into MetricSpecArgs ==============");
var deSerializedArgs = System.Text.Json.JsonSerializer.Deserialize<MetricSpecArgs>(jsonString);
Console.WriteLine($"deSerializedArgs.Type: {deSerializedArgs.Type}");
The above code appears to retrieve the JSON string successfully, but not able to deserialize too, it gives the output:
============== Get MetricSpecArgs JSON String via Config.Get ==============
jsonString: {"resource":{"name":"cpu"},"target":{"averageUtilization":50,"type":"Utilization"},"type":"Resource"}
============== Try Deserialize JSON String into MetricSpecArgs ==============
deSerializedArgs.Type: