StrongTypedId.NewtonSoft
2.1.0
See the version list below for details.
dotnet add package StrongTypedId.NewtonSoft --version 2.1.0
NuGet\Install-Package StrongTypedId.NewtonSoft -Version 2.1.0
<PackageReference Include="StrongTypedId.NewtonSoft" Version="2.1.0" />
<PackageVersion Include="StrongTypedId.NewtonSoft" Version="2.1.0" />
<PackageReference Include="StrongTypedId.NewtonSoft" />
paket add StrongTypedId.NewtonSoft --version 2.1.0
#r "nuget: StrongTypedId.NewtonSoft, 2.1.0"
#addin nuget:?package=StrongTypedId.NewtonSoft&version=2.1.0
#tool nuget:?package=StrongTypedId.NewtonSoft&version=2.1.0
StrongTypedId.NewtonSoft
This package provides support for using StrongTypedId with the NewtonSoft JSON serializer.
Usage
Add the StrongTypedNewtonSoftJsonConverter
to your serializer settings, there's no need to decorate your types with an
attribute any more.
var settings = new JsonSerializerSettings
{
Converters = { new StrongTypedNewtonSoftJsonConverter() }
};
var json = JsonConvert.SerializeObject(UserId.New(), settings);
OR
var serializer = new JsonSerializer()
{
Converters = { new StrongTypedNewtonSoftJsonConverter() }
};
var json = serializer.Serialize(writer, UserId.New());
Obsolete: Old Usage
Add a NewtonSoft.Json.JsonConverter
similarly to the built-in converters:
[TypeConverter(typeof(StrongTypedIdTypeConverter<UserId, Guid>))]
[StrongTypedIdJsonConverter<UserId, Guid>]
[Newtonsoft.Json.JsonConverter(typeof(NewtonSoftJsonConverter<UserId, Guid>))]
public class UserId: StrongTypedId<UserId, Guid>
{
public UserId(Guid value) : base(value)
{
}
}
Notice how you can have both JsonConverters applied simultaneously to support both WebAPI and NewtonSoft at the same time.
Documentation
Auto generated documentation via DocFx is available here: https://steffenskov.github.io/StrongTypedId/
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net9.0
- Newtonsoft.Json (>= 13.0.3)
- StrongTypedId (>= 2.1.0)
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 |
---|---|---|
2.2.0 | 162 | 3/12/2025 |
2.1.0 | 143 | 3/12/2025 |
2.0.0 | 5,257 | 12/30/2024 |
1.9.2 | 9,536 | 11/15/2024 |
1.9.1 | 104 | 11/13/2024 |
1.9.0 | 113 | 11/11/2024 |
1.8.0 | 14,128 | 8/26/2024 |
1.7.0 | 15,760 | 5/10/2024 |
1.6.6 | 8,198 | 2/9/2024 |
1.6.5 | 328 | 2/5/2024 |
1.6.4 | 180 | 1/31/2024 |
1.6.3 | 705 | 1/8/2024 |
1.6.2 | 5,662 | 10/10/2023 |
1.6.1 | 411 | 9/8/2023 |
1.6.0 | 188 | 7/18/2023 |
1.5.1 | 213 | 7/15/2023 |
1.5.0 | 225 | 7/15/2023 |
1.4.3 | 191 | 7/11/2023 |
1.4.2 | 190 | 7/11/2023 |
1.4.1 | 190 | 7/11/2023 |
1.4.0 | 181 | 7/10/2023 |
1.3.0 | 207 | 5/21/2023 |
1.2.0 | 370 | 1/21/2023 |
1.1.5 | 1,741 | 8/5/2022 |
1.1.4 | 1,343 | 7/10/2022 |
1.1.3 | 454 | 7/10/2022 |
1.1.2 | 454 | 5/12/2022 |
1.1.1 | 441 | 3/12/2022 |