Use source generator for device report JSON serializing.

This commit is contained in:
2022-12-16 20:35:28 +00:00
parent 4b75b226f2
commit 71b7d3ab37
3 changed files with 3 additions and 11 deletions

View File

@@ -68,11 +68,7 @@ public static class Remote
try
{
string json = JsonSerializer.Serialize(report, new JsonSerializerOptions()
{
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
WriteIndented = true
});
string json = JsonSerializer.Serialize(report, typeof(DeviceReport), DeviceReportContext.Default);
var httpClient = new HttpClient();

View File

@@ -1576,11 +1576,7 @@ sealed class DeviceReportCommand : Command
var jsonFs = new FileStream(jsonFile, FileMode.Create);
JsonSerializer.Serialize(jsonFs, report, new JsonSerializerOptions()
{
WriteIndented = true,
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
});
JsonSerializer.Serialize(jsonFs, report, typeof(DeviceReport), DeviceReportContext.Default);
jsonFs.Close();