FluxJson.Core
0.1.1
dotnet add package FluxJson.Core --version 0.1.1
NuGet\Install-Package FluxJson.Core -Version 0.1.1
<PackageReference Include="FluxJson.Core" Version="0.1.1" />
<PackageVersion Include="FluxJson.Core" Version="0.1.1" />
<PackageReference Include="FluxJson.Core" />
paket add FluxJson.Core --version 0.1.1
#r "nuget: FluxJson.Core, 0.1.1"
#:package FluxJson.Core@0.1.1
#addin nuget:?package=FluxJson.Core&version=0.1.1
#tool nuget:?package=FluxJson.Core&version=0.1.1
FluxJson ๐
Modern, high-performance JSON serialization library for .NET with a fluent API design, focusing on speed, flexibility, and developer experience.
โจ Features
- ๐ High Performance: Near-zero allocation using
Span<T>, SIMD optimizations, and performance-optimized modes - ๐ฏ Advanced Fluent API: Intuitive, chainable API with comprehensive configuration options
- โก Source Generators: Compile-time code generation with
[JsonSerializable]attribute for reflection-free serialization - ๐ง Extensive Configuration: Multiple naming strategies, flexible null handling, custom DateTime formats, and converter system
- ๐ Custom Converters: Built-in converters and support for custom type conversion logic
- โ๏ธ Performance Modes: Speed, Balanced, and Features modes to optimize for your specific use case
- ๐งช Comprehensive Testing: Extensive unit tests, integration tests, and benchmark suites
- ๐ฆ Modern .NET: Built for .NET 8+ with latest C# features and runtime improvements
๐ฆ Installation
NuGet Package Manager
Install-Package FluxJson.Core
.NET CLI
dotnet add package FluxJson.Core
Package Reference
<PackageReference Include="FluxJson.Core" Version="1.0.0" />
Note: Also install FluxJson.Generator package if you want compile-time source generation support.
๐ Quick Start
Basic Usage
using FluxJson;
// Quick serialization and deserialization
var person = new { Name = "Alice", Age = 30 };
// Serialize to JSON
var json = Json.Serialize(person);
Console.WriteLine(json); // {"Name":"Alice","Age":30}
// Deserialize from JSON
var deserialized = Json.Deserialize<dynamic>(json);
Console.WriteLine($"Name: {deserialized.Name}, Age: {deserialized.Age}");
Advanced Fluent API
using FluxJson.Core.Configuration;
// Fluent serialization with comprehensive configuration
var user = new User
{
FirstName = "Bob",
LastName = "Smith",
BirthDate = new DateTime(1990, 5, 15),
Email = null,
Settings = new UserSettings { Theme = "dark", Language = "en" }
};
var json = Json.From(user)
.Configure(config => config
.UseNaming(NamingStrategy.CamelCase) // Convert to camelCase
.HandleNulls(NullHandling.Ignore) // Skip null values
.FormatDates("yyyy-MM-dd") // Custom date format
.WriteIndented(true) // Pretty print JSON
.WithPerformanceMode(PerformanceMode.Speed) // Optimize for speed
)
.ToJson();
Console.WriteLine(json);
// {
// "firstName": "Bob",
// "lastName": "Smith",
// "birthDate": "1990-05-15",
// "settings": {
// "theme": "dark",
// "language": "en"
// }
// }
Source Generator Support
using FluxJson;
// Mark class for source-generated serialization (zero reflection)
[JsonSerializable]
public partial class Product : IJsonSerializable<Product>
{
public string Name { get; set; }
public decimal Price { get; set; }
public string[] Tags { get; set; }
}
// Usage - automatically uses generated code
var product = new Product { Name = "Laptop", Price = 999.99m, Tags = new[] { "electronics", "gaming" } };
var json = Json.From(product).ToJson();
// Compile-time generated methods used automatically
Custom Converters
using FluxJson.Core.Converters;
// Register custom converter
JsonConfiguration.Default.Converters.Add(new CustomDateConverter());
public class CustomDateConverter : IJsonConverter
{
// Implementation for custom date serialization/deserialization
}
๐ Performance
FluxJson is engineered to outperform existing .NET JSON serialization libraries. Benchmarks are continuously run to ensure optimal performance.
| Library | Serialize (ops/sec) | Deserialize (ops/sec) | Memory (KB) |
|---|---|---|---|
| FluxJson | โก๏ธ Excellent | โก๏ธ Excellent | โก๏ธ Minimal |
| System.Text.Json | Baseline | Baseline | Baseline |
| Newtonsoft.Json | ~50% slower | ~40% slower | ~2x more |
Note: Detailed benchmark results will be provided as the project matures and stabilizes.
๐๏ธ Architecture
FluxJson.Core/ # Core serialization library and public APIs
โโโ Configuration/ # Fluent configuration API and settings management
โ โโโ Enums.cs # NamingStrategy, NullHandling, PerformanceMode, etc.
โ โโโ JsonConfiguration.cs # Main configuration class
โโโ Converters/ # Built-in and custom type converters
โ โโโ IJsonConverter.cs # Converter interface
โ โโโ JsonConverterAttribute.cs # Attribute for custom converters
โ โโโ BuiltInConverters.cs # Pre-built converters
โโโ Extensions/ # Extension methods for convenience
โ โโโ StringExtensions.cs
โ โโโ JsonConfigurationExtensions.cs
โโโ Fluent/ # Advanced fluent API interfaces and implementations
โ โโโ IJsonConfigurationBuilder.cs
โ โโโ JsonConfigurationBuilder.cs
โ โโโ JsonBuilder.cs # Fluent chaining support
โโโ Serialization/ # Low-level serialization/deserialization logic
โ โโโ JsonBuilder.cs # Core serialization engine
โ โโโ DefaultJsonBuilder.cs
โ โโโ ReflectionBasedJsonBuilder.cs
โ โโโ JsonSerializationLogic.cs
โโโ Global features # Core types and utilities
โโโ IJsonSerializable.cs
โโโ JsonSerializableAttribute.cs
โโโ TypeHelpers.cs
FluxJson.Generator/ # Source Generator for compile-time optimizations
โโโ JsonSourceGenerator.cs # Main generator with [JsonSerializable] support
โโโ JsonSerializationGenerator.cs
โโโ JsonDeserializationGenerator.cs
โโโ SyntaxReceiver.cs # Roslyn syntax analysis
โโโ ...
FluxJson.Benchmarks/ # Performance testing suite using BenchmarkDotNet
โโโ Multiple benchmark classes for comprehensive performance analysis
tests/ # Comprehensive test suite
โโโ FluxJson.Core.Tests/ # Unit tests for core functionality
โโโ FluxJson.Integration.Tests/ # Integration tests
โโโ ...
โ๏ธ Configuration Options
FluxJson offers extensive configuration options to fit any serialization scenario:
Naming Strategies
- NamingStrategy.CamelCase:
FirstNameโfirstName - NamingStrategy.SnakeCase:
FirstNameโfirst_name - NamingStrategy.KebabCase:
FirstNameโfirst-name - NamingStrategy.PascalCase:
firstNameโFirstName
Null Handling
- NullHandling.Include: Include null values in output
- NullHandling.Ignore: Skip null properties entirely
DateTime Formatting
- DateTimeFormat.ISO8601: Standard ISO 8601 format
- DateTimeFormat.UnixTimestamp: Unix timestamp (seconds since epoch)
- DateTimeFormat.Custom: Use custom format string
Performance Modes
- PerformanceMode.Speed: Maximum performance, minimal features
- PerformanceMode.Balanced: Balance between speed and features
- PerformanceMode.Features: Enable all features, slightly slower
Advanced Options
- Custom converters for complex types
- JSON pretty-printing (WriteIndented)
- Trailing comma support
- Case-sensitive parsing
- Read-only property handling
- Maximum depth limits
๐ฏ Roadmap
โ Completed Features
- Project setup and core architecture
- Initial core serialization engine
- Advanced fluent API implementation with chaining
- Source generator integration for basic types with
[JsonSerializable]attribute - Multiple naming strategies (CamelCase, SnakeCase, KebabCase, PascalCase)
- Flexible null handling (Include/Ignore)
- Custom DateTime formatting (ISO8601, Unix timestamp, custom formats)
- Performance modes (Speed, Balanced, Features)
- Custom converter system with built-in converters
- Extension methods for configuration and utilities
- Comprehensive unit and integration test suite
- BenchmarkDotNet performance testing suite
- Token-based JSON parser with multiple token types
- Attribute-based serialization control
๐ง In Progress / Planned
- Advanced performance optimizations (SIMD, Span<T> further integration)
- Comprehensive source generator support for complex types and configurations
- Detailed benchmark suite with public results and comparisons
- Extensive documentation and usage guides
- Support for custom attributes and advanced mapping scenarios
- JSON Schema validation and generation
- Streaming serialization for large datasets
- Plugin architecture for extensions
- Integration with popular .NET web frameworks
๐ค Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
๐ License
This project is licensed under the MIT License - see LICENSE file for details.
Built with โค๏ธ for the .NET community. ๐
**Built with โค๏ธ for the .
508d4b4f8125e2354fe49d0f0dc27b9a12c1b410
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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 was computed. 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. |
-
net8.0
- System.Memory (>= 4.5.5)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
- System.Text.Json (>= 9.0.0-preview.7.24405.7)
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 |
|---|---|---|
| 0.1.1 | 206 | 9/3/2025 |
| 0.1.0-alpha | 178 | 8/31/2025 |