A high-performance JSON serialization library for .NET 5+ using C# source generators.
JsonSrcGen is a JSON serialization library for .NET that uses C# source generators to create highly optimized serialization and deserialization code at compile time. It eliminates reflection overhead, providing faster performance and lower memory usage for applications that frequently handle JSON data.
.NET developers building high-performance applications, such as APIs, microservices, or data-intensive systems, who need efficient JSON serialization without runtime reflection penalties.
Developers choose JsonSrcGen for its compile-time code generation, which offers superior performance over reflection-based JSON libraries, along with features like UTF8 support, custom converters, and fine-grained control over serialization behavior.
Json library that uses .NET 5 Source Generators
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Generates serialization code at compile time using .NET source generators, eliminating runtime reflection overhead for faster serialization and deserialization.
Supports UTF8 serialization via `ReadOnlySpan<byte>` methods like `ToJsonUtf8`, enabling low-memory, byte-level operations that optimize performance for high-throughput applications.
Offers attributes such as `[JsonIgnoreNull]` to skip null properties and `[JsonOptional]` to set defaults for missing JSON, allowing precise serialization behavior.
Enables object reuse in deserialization with the `JsonOptional` attribute, reducing allocations and providing significant performance gains for repeated operations.
Allows implementing `ICustomConverter<T>` with the `[CustomConverter]` attribute, giving developers control over custom type serialization logic.
Only supports dictionaries with string keys, as stated in the README, which restricts use cases with complex or non-string key types.
Requires defining attributes like `[assembly: JsonArray]` at the assembly level for arrays, lists, and dictionaries, adding setup complexity and boilerplate code.
Relies on .NET 5+ source generators, which can be unfamiliar to developers used to reflection-based libraries, and the attribute-based configuration is less intuitive.
Requires .NET 5 or later, limiting adoption in legacy projects or environments stuck on older .NET frameworks without migration efforts.