Refactor OpenInsight file handling to utilize JsonElement for data processing and enhance serialization with JsonSourceGeneration. Updated methods across multiple classes to improve data handling and reduce dependencies on ProcessDataStandardFormat.

This commit is contained in:
2025-09-08 10:45:56 -07:00
parent 5a5c478419
commit 5f8c79e087
13 changed files with 186 additions and 131 deletions

View File

@ -395,12 +395,11 @@ public class ProcessData : IProcessData
{
List<Description> results = new();
Description? description;
JsonSerializerOptions jsonSerializerOptions = new() { NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString };
foreach (JsonElement jsonElement in jsonElements)
{
if (jsonElement.ValueKind != JsonValueKind.Object)
throw new Exception();
description = JsonSerializer.Deserialize<Description>(jsonElement.ToString(), jsonSerializerOptions);
description = JsonSerializer.Deserialize(jsonElement.ToString(), DescriptionSourceGenerationContext.Default.Description);
if (description is null)
continue;
results.Add(description);