using System.IO;
using System.Text;
using System.Text.Json;
+using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
public DateTime timeStamp;
}
+ [JsonSourceGenerationOptions(IncludeFields = true, WriteIndented = true)]
+ [JsonSerializable(typeof(JsonResultsData))]
+ partial class ResultsSerializerContext : JsonSerializerContext { }
+
string GetJsonResults()
{
- var options = new JsonSerializerOptions { IncludeFields = true, WriteIndented = true };
var jsonObject = new JsonResultsData { results = results, minTimes = minTimes, timeStamp = DateTime.UtcNow };
- return JsonSerializer.Serialize(jsonObject, options);
+ return JsonSerializer.Serialize(jsonObject, ResultsSerializerContext.Default.JsonResultsData);
}
private void PrintJsonResults()