public override ListQueryResult <T> Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { ListQueryResult <T> result = new ListQueryResult <T>(); while (reader.Read()) { if (reader.TokenType == JsonTokenType.PropertyName) { String key = reader.GetString(); if (key == "total_count") { reader.Read(); result.TotalCount = reader.GetInt32(); } else if (key == "start_offset") { reader.Read(); result.StartOffset = reader.GetInt32(); } else if (key == "data") { result.Data = JsonSerializer.Deserialize <List <T> >(ref reader, options); reader.Read(); // read before returning so we can continue the process down the chain return(result); } } } return(result); }
public override void Write(Utf8JsonWriter writer, ListQueryResult <T> value, JsonSerializerOptions options) { throw new NotImplementedException(); }