CSharpEssentials.Json
3.0.3
See the version list below for details.
dotnet add package CSharpEssentials.Json --version 3.0.3
NuGet\Install-Package CSharpEssentials.Json -Version 3.0.3
<PackageReference Include="CSharpEssentials.Json" Version="3.0.3" />
<PackageVersion Include="CSharpEssentials.Json" Version="3.0.3" />
<PackageReference Include="CSharpEssentials.Json" />
paket add CSharpEssentials.Json --version 3.0.3
#r "nuget: CSharpEssentials.Json, 3.0.3"
#:package CSharpEssentials.Json@3.0.3
#addin nuget:?package=CSharpEssentials.Json&version=3.0.3
#tool nuget:?package=CSharpEssentials.Json&version=3.0.3
CSharpEssentials.Json
Enhanced JSON serialization utilities on top of System.Text.Json.
Features
- Conditional String Enums — Enums marked with
[StringEnum]serialize as strings; others stay as integers. - Multi-Format DateTime — Deserialize from many date formats automatically.
- Polymorphic Serialization — Serialize abstract types and interfaces with a
$typediscriminator. - Pre-Configured Options — CamelCase, ignore cycles, ignore nulls, relaxed escaping.
Installation
dotnet add package CSharpEssentials.Json
Usage
Pre-Configured Options
using CSharpEssentials.Json;
using System.Text.Json;
var options = EnhancedJsonSerializerOptions.DefaultOptions;
string json = JsonSerializer.Serialize(myObject, options);
Quick Extensions
var user = new { Name = "Alice", Age = 30 };
string json = user.ConvertToJson();
var parsed = json.ConvertFromJson<User>();
JsonDocument doc = json.ConvertToJsonDocument();
String Enum Serialization
using CSharpEssentials.Enums;
[StringEnum]
public enum Status { Active, Inactive }
public enum Level { Low, High }
var data = new { S = Status.Active, L = Level.High };
string json = data.ConvertToJson(); // {"s":"active","l":1}
Polymorphic Serialization
public abstract class Animal { public string Name { get; set; } = string.Empty; }
public class Dog : Animal { public string Breed { get; set; } = string.Empty; }
Animal dog = new Dog { Name = "Rex", Breed = "Labrador" };
string json = dog.ConvertToJson(); // {"$type":"Dog", "name":"Rex", "breed":"Labrador"}
Animal? restored = json.ConvertFromJson<Animal>();
Multi-Format DateTime
// All formats work automatically
string[] dates = ["2024-03-14T15:30:45Z", "14.03.2024", "March 14, 2024"];
foreach (var d in dates)
{
DateTime dt = d.ConvertFromJson<DateTime>();
}
| 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 was computed. 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. net11.0 is compatible. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | 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.1
- CSharpEssentials.Enums (>= 3.0.3)
- System.Text.Json (>= 9.0.0)
-
net10.0
- CSharpEssentials.Enums (>= 3.0.3)
-
net11.0
- CSharpEssentials.Enums (>= 3.0.3)
-
net9.0
- CSharpEssentials.Enums (>= 3.0.3)
NuGet packages (7)
Showing the top 5 NuGet packages that depend on CSharpEssentials.Json:
| Package | Downloads |
|---|---|
|
CSharpEssentials
A comprehensive C# library enhancing functional programming capabilities with type-safe monads (Maybe, Result), discriminated unions (Any), and robust error handling. Features include: domain-driven design support, enhanced Entity Framework integration, testable time management, JSON utilities, and LINQ extensions. Built for modern C# development with focus on maintainability, testability, and functional programming principles. |
|
|
CSharpEssentials.EntityFrameworkCore
Enhances Entity Framework Core with functional programming patterns and DDD-friendly features. Includes base entity classes, soft delete support, audit trails, query filters, optimistic concurrency, PostgreSQL integration, query performance monitoring, and domain event handling. Perfect for building maintainable and scalable data access layers in modern .NET applications. |
|
|
CSharpEssentials.AspNetCore
A comprehensive ASP.NET Core library that enhances functional programming capabilities in web applications. Features include API versioning, global exception handling with enhanced problem details, advanced Swagger/OpenAPI configuration, model validation, optimized JSON handling, and seamless integration with CSharpEssentials core functional patterns (Result, Maybe, Rule Engine). Perfect for building robust, maintainable, and type-safe web APIs following functional programming principles. |
|
|
CSharpEssentials.Results
Result pattern implementation for functional error handling in C#. Provides Result<T> and Result types for railway-oriented programming, eliminating exceptions for expected failures. Foundation for functional programming patterns and robust error handling. |
|
|
CSharpEssentials.Any
Discriminated union types (Any<T0,T1> to Any<T0,...,T7>) for functional programming in C#. Provides type-safe alternatives to object/dynamic with pattern matching, implicit conversions, and JSON serialization support. Essential for functional programming patterns and type-safe handling of multiple possible types. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.0.5 | 365 | 5/7/2026 |
| 3.0.4 | 369 | 5/6/2026 |
| 3.0.3 | 371 | 5/5/2026 |
| 3.0.2 | 359 | 5/5/2026 |
| 3.0.1 | 325 | 5/3/2026 |
| 3.0.0 | 346 | 5/3/2026 |
| 2.1.0 | 382 | 11/26/2025 |
| 2.0.9 | 331 | 9/30/2025 |
| 2.0.8 | 310 | 9/29/2025 |
| 2.0.7 | 314 | 9/29/2025 |
| 2.0.6 | 308 | 9/29/2025 |
| 2.0.5 | 319 | 9/29/2025 |
| 2.0.4 | 312 | 9/28/2025 |
| 2.0.3 | 315 | 9/28/2025 |
| 2.0.2 | 315 | 9/28/2025 |
| 2.0.1 | 321 | 9/28/2025 |
| 2.0.0 | 317 | 9/28/2025 |