Lite3.Net 0.9.3

dotnet add package Lite3.Net --version 0.9.3
                    
NuGet\Install-Package Lite3.Net -Version 0.9.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Lite3.Net" Version="0.9.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Lite3.Net" Version="0.9.3" />
                    
Directory.Packages.props
<PackageReference Include="Lite3.Net" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Lite3.Net --version 0.9.3
                    
#r "nuget: Lite3.Net, 0.9.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Lite3.Net@0.9.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Lite3.Net&version=0.9.3
                    
Install as a Cake Addin
#tool nuget:?package=Lite3.Net&version=0.9.3
                    
Install as a Cake Tool

Lite³: A JSON-Compatible Zero-Copy Serialization Format

NuGet

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>.
  • Try and non-Try overloads 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's Utf8JsonReader and Utf8JsonWriter internally.
    • Asynchronous decode/encode using System.IO.Pipelines's PipeReader and PipeWriter, respectively.
    • Synchronous decode/encode using Span<byte> and System.Buffers.IBufferWriter<byte>, respectively.
  • Enumeration by foreach against a struct enumerator.

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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