public override DicomDataset[] Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { var datasetList = new List <DicomDataset>(); if (reader.TokenType != JsonTokenType.StartArray) { return(datasetList.ToArray()); } reader.Read(); var conv = new DicomJsonConverter(writeTagsAsKeywords: _writeTagsAsKeywords); while (reader.TokenType != JsonTokenType.EndArray) { DicomDataset ds; switch (reader.TokenType) { case JsonTokenType.StartObject: ds = conv.Read(ref reader, typeToConvert, options); reader.AssumeAndSkip(JsonTokenType.EndObject); break; case JsonTokenType.Null: ds = null; reader.Read(); break; default: throw new JsonException($"Expected either the start of an object or null but found '{reader.TokenType}'."); } datasetList.Add(ds); } reader.Read(); return(datasetList.ToArray()); }