Lite3.Net
0.9.3
dotnet add package Lite3.Net --version 0.9.3
NuGet\Install-Package Lite3.Net -Version 0.9.3
<PackageReference Include="Lite3.Net" Version="0.9.3" />
<PackageVersion Include="Lite3.Net" Version="0.9.3" />
<PackageReference Include="Lite3.Net" />
paket add Lite3.Net --version 0.9.3
#r "nuget: Lite3.Net, 0.9.3"
#:package Lite3.Net@0.9.3
#addin nuget:?package=Lite3.Net&version=0.9.3
#tool nuget:?package=Lite3.Net&version=0.9.3
Lite³: A JSON-Compatible Zero-Copy Serialization Format
This is a C# port of Lite³.
Current Status
Note that this project is in beta status, as specifications are being defined for Lite³.
This port currently tracks upstream ac7fc19.
Feature Parity
This port includes two APIs, which correspond closely to the C impementation:
- Buffer API: for working directly against fixed
Span<byte>buffers. - Context API: for working against a resizable buffer, which is internally managed by
ArrayPool<byte>. Tryand non-Tryoverloads for exceptionless use if desired.
These APIs are supported by a Source Generator against the core implementation, which closely matches the reference C implementation.
Additionally, feature-parity is provided in general, with additional features specific to .NET.
- JSON decoding and encoding
- Uses
System.Text.Json'sUtf8JsonReaderandUtf8JsonWriterinternally. - Asynchronous decode/encode using
System.IO.Pipelines'sPipeReaderandPipeWriter, respectively. - Synchronous decode/encode using
Span<byte>andSystem.Buffers.IBufferWriter<byte>, respectively.
- Uses
- Enumeration by
foreachagainst astructenumerator.
Code Example
The following example using the Buffer API outputs Max Retries: 3.
var buffer = new byte[1024];
Lite3.InitializeObject(buffer, out var position);
Lite3.SetString(buffer, ref position, 0, "app_name"u8, "demo_app"u8);
Lite3.SetLong(buffer, ref position, 0, "max_retries"u8, 3);
Lite3.SetBool(buffer, ref position, 0, "debug_mode"u8, false);
var maxRetries = Lite3.GetLong(buffer, 0, "max_retries"u8);
Console.WriteLine($"Max Retries: {maxRetries}");
The equivalent Context API code is below.
using var context = Lite3Context.Create();
context
.InitializeObject()
.SetString(0, "app_name"u8, "demo_app"u8)
.SetLong(0, "max_retries"u8, 3)
.SetBool(0, "debug_mode"u8, false);
var maxRetries = context.GetLong(0, "max_retries"u8);
Console.WriteLine($"Max Retries: {maxRetries}");
See ContextApiExamples.cs and BufferApiExamples.cs for more examples.
Attribution
This project is a C# port of the original Lite³ C implementation by Elias de Jong. All credit for the original design belongs to the original authors.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. |
-
net10.0
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.2)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Lite3.Net:
| Package | Downloads |
|---|---|
|
Lite3.Net.SystemTextJson
JSON Encoding for Lite³ |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.9.3 | 0 | 1/29/2026 |
| 0.9.2 | 54 | 1/28/2026 |
| 0.9.1 | 63 | 1/28/2026 |
| 0.9.0 | 74 | 1/27/2026 |
| 0.8.2 | 82 | 1/26/2026 |
| 0.8.1 | 78 | 1/26/2026 |
| 0.8.0 | 74 | 1/26/2026 |
| 0.7.0 | 78 | 1/26/2026 |
| 0.6.0 | 77 | 1/26/2026 |
| 0.5.8 | 78 | 1/26/2026 |
| 0.5.7 | 74 | 1/26/2026 |
| 0.5.6 | 76 | 1/26/2026 |
| 0.5.5 | 83 | 1/26/2026 |
| 0.5.4 | 90 | 1/25/2026 |
| 0.5.3 | 76 | 1/24/2026 |
| 0.5.1 | 79 | 1/24/2026 |
| 0.4.0 | 82 | 1/24/2026 |
| 0.3.1 | 95 | 1/24/2026 |
| 0.3.0 | 80 | 1/24/2026 |