using System.Text.Json.Serialization;
using System.Collections.Generic;
using System.Collections;
public static void Main()
string json = @"[{""prefix"":""SB"",""identifier"":""1"",""brief_title"":""Natural resources: fishing;This is a TEST"",""house_conferees"":[""Carter"", ""Coleman"", ""Haadsma""],""senate_conferees"":[""Anthony"", ""Bayer"", ""Hauck""],""house_agreed"":""1/1/2023"",""senate_agreed"":""""}]";
string json2 = @"[{""prefix"":""SB"",""identifier"":""1"",""brief_title"":""Natural resources: fishing;This is a TEST"",""house_conferees"":[""Carter"", ""Coleman"", ""Haadsma""],""senate_conferees"":[""Anthony"", ""Bayer"", ""Hauck""],""house_agreed"":null,""senate_agreed"":null}]";
IEnumerable<TestThing> things = JsonSerializer.Deserialize<IEnumerable<TestThing>>(json);
Console.WriteLine(things.Count());
TestThing thing = things.FirstOrDefault();
Console.WriteLine("Prefix: " + thing.Prefix);
Console.WriteLine("Identifier: " + thing.Identifier);
Console.WriteLine("Brief Title: " + thing.BriefTitle);
Console.WriteLine("House Conferees: " + thing.HouseConferees.Length);
Console.WriteLine("Senate Conferees: " + thing.SenateConferees.Length);
Console.WriteLine("House Agreed: " + thing.HouseAgreed);
Console.WriteLine("Senate Agreed: " + thing.SenateAgreed);
private class NullableDateTimeConverter : JsonConverter<DateTime?>
public override DateTime? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
string value = reader.GetString();
if(String.IsNullOrEmpty(value)) {
return DateTime.Parse(value);
public override void Write(Utf8JsonWriter writer,
JsonSerializerOptions options)
throw new NotImplementedException();
public string Prefix {get;set;}
public string Identifier {get;set;}
[JsonPropertyName("brief_title")]
public string BriefTitle {get;set;}
[JsonPropertyName("house_conferees")]
public string[] HouseConferees {get;set;}
[JsonPropertyName("senate_conferees")]
public string[] SenateConferees {get;set;}
[JsonPropertyName("house_agreed")]
[JsonConverter(typeof(NullableDateTimeConverter))]
public DateTime? HouseAgreed {get;set;}
[JsonPropertyName("senate_agreed")]
[JsonConverter(typeof(NullableDateTimeConverter))]
public DateTime? SenateAgreed {get;set;}