StrongTypedId.NewtonSoft
2.5.2
dotnet add package StrongTypedId.NewtonSoft --version 2.5.2
NuGet\Install-Package StrongTypedId.NewtonSoft -Version 2.5.2
<PackageReference Include="StrongTypedId.NewtonSoft" Version="2.5.2" />
<PackageVersion Include="StrongTypedId.NewtonSoft" Version="2.5.2" />
<PackageReference Include="StrongTypedId.NewtonSoft" />
paket add StrongTypedId.NewtonSoft --version 2.5.2
#r "nuget: StrongTypedId.NewtonSoft, 2.5.2"
#:package StrongTypedId.NewtonSoft@2.5.2
#addin nuget:?package=StrongTypedId.NewtonSoft&version=2.5.2
#tool nuget:?package=StrongTypedId.NewtonSoft&version=2.5.2
Want to see what's changed?
StrongTypedId.NewtonSoft
This package provides support for using StrongTypedId with the NewtonSoft JSON serializer.
Usage
First add the StrongTypedNewtonSoftJsonConverter to your serializer settings.
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());
This will serialize any StrongTypedId, StrongTypedGuid or StrongTypedValue with explicit type information,
allowing deserialization even if your model is abstract.
If you furthermore have types you'd prefer serialized as their underlying value, you can add a
Newtonsoft.Json.JsonConverter attribute to the type:
[StrongTypedValueJsonConverterFactory]
[Newtonsoft.Json.JsonConverter(typeof(NewtonSoftJsonConverter<UserId, Guid>))] // This is the converter for NewtonSoft.
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. net10.0 was computed. 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. |
-
net9.0
- Newtonsoft.Json (>= 13.0.4)
- StrongTypedId (>= 2.5.2)
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.5.2 | 490 | 1/29/2026 |
| 2.5.1 | 351 | 10/15/2025 |
| 2.5.0 | 222 | 10/15/2025 |
| 2.4.0 | 3,865 | 8/17/2025 |
| 2.3.3 | 2,385 | 7/23/2025 |
| 2.3.2 | 520 | 7/21/2025 |
| 2.3.1 | 220 | 7/11/2025 |
| 2.3.0 | 254 | 7/6/2025 |
| 2.2.1 | 181 | 7/5/2025 |
| 2.2.0 | 1,081 | 3/12/2025 |
| 2.1.0 | 273 | 3/12/2025 |
| 2.0.0 | 8,237 | 12/30/2024 |
| 1.9.2 | 9,684 | 11/15/2024 |
| 1.9.1 | 221 | 11/13/2024 |
| 1.9.0 | 232 | 11/11/2024 |
| 1.8.0 | 14,262 | 8/26/2024 |
| 1.7.0 | 15,881 | 5/10/2024 |
| 1.6.6 | 8,341 | 2/9/2024 |
| 1.6.5 | 468 | 2/5/2024 |
| 1.6.4 | 299 | 1/31/2024 |