using System.Text.Json;
using System.Text.Json.Serialization;
namespace AVEVA.Historian.Client.StoreForward;
///
/// Shared JSON settings for persisting envelopes. The custom
/// normalizes HistorianEvent.Properties values (typed
/// ) back to plain CLR scalars on read instead of leaving raw
/// s, so a rehydrated event matches what the producer enqueued.
///
internal static class OutboxJson
{
public static readonly JsonSerializerOptions Options = CreateOptions();
private static JsonSerializerOptions CreateOptions()
{
var options = new JsonSerializerOptions
{
WriteIndented = false,
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
};
options.Converters.Add(new ObjectConverter());
return options;
}
private sealed class ObjectConverter : JsonConverter