using System.Text.Json; using System.Text.Json.Serialization; namespace Observatory.Framework.Files.Converters; public class IntBoolFlexConverter : JsonConverter { public override bool Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType == JsonTokenType.Number) return reader.GetInt16() == 1; return reader.GetBoolean(); } public override void Write(Utf8JsonWriter writer, bool value, JsonSerializerOptions options) { writer.WriteBooleanValue(value); } }