Soenneker.Json.CollectionConverter
4.0.849
Prefix Reserved
See the version list below for details.
dotnet add package Soenneker.Json.CollectionConverter --version 4.0.849
NuGet\Install-Package Soenneker.Json.CollectionConverter -Version 4.0.849
<PackageReference Include="Soenneker.Json.CollectionConverter" Version="4.0.849" />
<PackageVersion Include="Soenneker.Json.CollectionConverter" Version="4.0.849" />
<PackageReference Include="Soenneker.Json.CollectionConverter" />
paket add Soenneker.Json.CollectionConverter --version 4.0.849
#r "nuget: Soenneker.Json.CollectionConverter, 4.0.849"
#:package Soenneker.Json.CollectionConverter@4.0.849
#addin nuget:?package=Soenneker.Json.CollectionConverter&version=4.0.849
#tool nuget:?package=Soenneker.Json.CollectionConverter&version=4.0.849
Soenneker.Json.CollectionConverter
A System.Text.Json converter factory that applies an item converter to arrays and compatible generic collections.
Install
dotnet add package Soenneker.Json.CollectionConverter
Register
using System.Text.Json;
using System.Text.Json.Serialization;
using Soenneker.Json.CollectionConverter;
var options = new JsonSerializerOptions();
options.Converters.Add(
new CollectionConverter<JsonStringEnumConverter>());
The generic argument must be a parameterless JsonConverter or JsonConverterFactory whose CanConvert() accepts the collection's item type.
Usage
DayOfWeek[] days =
JsonSerializer.Deserialize<DayOfWeek[]>(
"[\"Monday\",\"Friday\"]",
options)!;
string json = JsonSerializer.Serialize(days, options);
// ["Monday","Friday"]
The factory handles one-dimensional arrays, concrete ICollection<T> implementations with a public parameterless constructor, compatible set interfaces through HashSet<T>, and compatible collection interfaces through List<T>.
Collections that can be enumerated but cannot be constructed are serialization-only; attempting to deserialize one throws NotImplementedException. Strings, dictionaries, multidimensional arrays, and types exposing conflicting IEnumerable<T> item types are not handled by this factory.
The item converter is inserted ahead of the copied serializer converter list for item reads and writes. Each CollectionConverter<TItemConverter> instance owns its item converter and compiled collection factories, so converter state is not shared between separate serializer configurations.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Soenneker.Extensions.Type (>= 4.0.701)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.854 | 125 | 9/26/2026 |
| 4.0.853 | 91 | 9/25/2026 |
| 4.0.852 | 644 | 9/15/2026 |
| 4.0.851 | 96 | 9/15/2026 |
| 4.0.850 | 193 | 9/15/2026 |
| 4.0.849 | 924 | 9/12/2026 |
| 4.0.848 | 104 | 9/12/2026 |
| 4.0.846 | 1,070 | 9/7/2026 |
| 4.0.845 | 1,769 | 8/30/2026 |
| 4.0.844 | 165 | 8/30/2026 |
| 4.0.843 | 194 | 8/30/2026 |
| 4.0.842 | 157 | 8/29/2026 |
| 4.0.841 | 165 | 8/29/2026 |
| 4.0.840 | 102 | 8/29/2026 |
| 4.0.839 | 191 | 8/29/2026 |
| 4.0.838 | 656 | 8/25/2026 |
| 4.0.837 | 3,142 | 7/28/2026 |
| 4.0.836 | 201 | 7/28/2026 |
| 4.0.835 | 123 | 7/28/2026 |
| 4.0.834 | 1,375 | 7/17/2026 |
Update dependency Soenneker.Extensions.Type to 4.0.701 (#1103)