CasCap.Common.Serialization.Json
4.17.0
Prefix Reserved
dotnet add package CasCap.Common.Serialization.Json --version 4.17.0
NuGet\Install-Package CasCap.Common.Serialization.Json -Version 4.17.0
<PackageReference Include="CasCap.Common.Serialization.Json" Version="4.17.0" />
<PackageVersion Include="CasCap.Common.Serialization.Json" Version="4.17.0" />
<PackageReference Include="CasCap.Common.Serialization.Json" />
paket add CasCap.Common.Serialization.Json --version 4.17.0
#r "nuget: CasCap.Common.Serialization.Json, 4.17.0"
#:package CasCap.Common.Serialization.Json@4.17.0
#addin nuget:?package=CasCap.Common.Serialization.Json&version=4.17.0
#tool nuget:?package=CasCap.Common.Serialization.Json&version=4.17.0
CasCap.Common.Serialization.Json
System.Text.Json serialization helpers and custom JsonConverter implementations.
Installation
dotnet add package CasCap.Common.Serialization.Json
Target frameworks: netstandard2.0, net8.0, net9.0, net10.0
Usage
using System;
using System.Collections.Generic;
using CasCap.Common.Extensions;
var original = new Dictionary<string, string> { ["theme"] = "dark" };
var json = original.ToJson();
var restored = json.FromJson<Dictionary<string, string>>();
Console.WriteLine(restored?["theme"]); // dark
ToJson and FromJson<T> accept optional JsonSerializerOptions. They log and rethrow
serialization errors. TryFromJson<T> logs a warning and returns false on deserialization failure;
a null input still throws. A valid JSON null can deserialize successfully to a null result.
Custom Converters
Register converters explicitly on the options used for the call:
using System;
using System.Text.Json;
using CasCap.Common.Converters;
using CasCap.Common.Extensions;
var options = new JsonSerializerOptions();
options.Converters.Add(new ParseEnumConverter<DayOfWeek>());
var day = "\"friday\"".FromJson<DayOfWeek>(options);
Console.WriteLine(day); // Friday
| Converter | Purpose |
|---|---|
Array2DConverter |
Rectangular two-dimensional arrays represented as nested JSON arrays |
MicrosecondEpochConverter |
Nullable DateTime values represented as Unix microseconds |
MillisecondEpochConverter |
Nullable DateTime values represented as Unix milliseconds |
ParseEnumConverter<TEnum> |
Case-insensitive enum names |
RawJsonStringConverter |
Embed valid JSON held in a string without double encoding; .NET 8+ only |
StringToIntConverter |
Nullable integers supplied as JSON strings |
To2D() also converts rectangular lists of lists into a two-dimensional array; inconsistent row
lengths throw. Conversion does not change the default System.Text.Json options globally.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. 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 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- CasCap.Common.Extensions (>= 4.17.0)
- CasCap.Common.Logging (>= 4.17.0)
-
net10.0
- CasCap.Common.Extensions (>= 4.17.0)
- CasCap.Common.Logging (>= 4.17.0)
-
net8.0
- CasCap.Common.Extensions (>= 4.17.0)
- CasCap.Common.Logging (>= 4.17.0)
-
net9.0
- CasCap.Common.Extensions (>= 4.17.0)
- CasCap.Common.Logging (>= 4.17.0)
NuGet packages (6)
Showing the top 5 NuGet packages that depend on CasCap.Common.Serialization.Json:
| Package | Downloads |
|---|---|
|
CasCap.Common.Net
Helper library for common HttpClient/WebAPI requirements. |
|
|
CasCap.Common.Caching
Helper library for local and remote object caching. |
|
|
CasCap.Api.Azure.Storage
Helper library for Azure Blob, Queue, and Table storage operations. |
|
|
CasCap.Apis.Azure.Storage
Helper library for Azure Storage Services. |
|
|
CasCap.Api.Knx
.NET client library for KNX building automation — connects via KNXnet/IP tunnelling or routing, monitors group-address telegrams, and fans events out to configurable sinks. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.17.0 | 456 | 10/24/2026 |
| 4.16.0 | 368 | 10/21/2026 |
| 4.15.0 | 266 | 10/6/2026 |
| 4.14.4 | 457 | 10/4/2026 |
| 4.14.3 | 246 | 9/28/2026 |
| 4.14.2 | 456 | 9/25/2026 |
| 4.14.1 | 514 | 9/23/2026 |
| 4.14.0 | 818 | 9/19/2026 |
| 4.13.0 | 207 | 9/15/2026 |
| 4.12.8 | 498 | 9/10/2026 |
| 4.12.7 | 512 | 9/4/2026 |
| 4.12.6 | 260 | 9/1/2026 |
| 4.12.5 | 338 | 8/20/2026 |
| 4.12.4 | 491 | 8/18/2026 |
| 4.12.3 | 470 | 7/15/2026 |
| 4.12.2 | 461 | 6/26/2026 |
| 4.12.1 | 439 | 6/14/2026 |
| 4.12.0 | 517 | 6/12/2026 |
| 4.11.9 | 449 | 6/10/2026 |
| 4.11.8 | 391 | 5/27/2026 |