Sunmeat.Prism
1.0.2
dotnet add package Sunmeat.Prism --version 1.0.2
NuGet\Install-Package Sunmeat.Prism -Version 1.0.2
<PackageReference Include="Sunmeat.Prism" Version="1.0.2" />
<PackageVersion Include="Sunmeat.Prism" Version="1.0.2" />
<PackageReference Include="Sunmeat.Prism" />
paket add Sunmeat.Prism --version 1.0.2
#r "nuget: Sunmeat.Prism, 1.0.2"
#:package Sunmeat.Prism@1.0.2
#addin nuget:?package=Sunmeat.Prism&version=1.0.2
#tool nuget:?package=Sunmeat.Prism&version=1.0.2

Sunmeat.Prism
One object. Any format.
Prism serializes ordinary C# objects as Prism Binary, JSON, XML, YAML, TOML, or CBOR through a single API.
Install
Current release: 1.0.2.
Install Sunmeat.Prism from NuGet:
dotnet add package Sunmeat.Prism --version 1.0.2
Or install the latest available version:
dotnet add package Sunmeat.Prism
A single package includes all six codecs. It targets .NET 8, 9, 10, and 11.
See the runtime and platform verification details.
Quick start
using Sunmeat.Prism;
var person = new Person
{
Name = "Олена 🌻",
Age = 29,
IsAdult = true,
Password = "local-only"
};
byte[] binary = Prism.Serialize(person);
Person restored = Prism.Deserialize<Person>(binary);
var jsonCopy = Prism.FromJson<Person>(Prism.ToJson(person));
var xmlCopy = Prism.FromXml<Person>(Prism.ToXml(person));
var yamlCopy = Prism.FromYaml<Person>(Prism.ToYaml(person));
var tomlCopy = Prism.FromToml<Person>(Prism.ToToml(person));
var cborCopy = Prism.FromCbor<Person>(Prism.ToCbor(person));
public sealed class Person
{
public string Name { get; set; } = "";
public int Age { get; set; }
public bool IsAdult;
[NonSerialize]
public string Password { get; set; } = "";
}
Prism includes public fields and restorable public properties by default.
[NonSerialize] excludes a member in both directions for all formats.
Positional records, parameterized constructors, init-only properties, and common immutable collections are supported.
Files, encryption, and conversion
using System.Security.Cryptography;
using Sunmeat.Prism;
await Prism.SaveAsync(
person,
"person.yaml",
cancellationToken: cancellationToken);
var restored = await Prism.LoadAsync<Person>(
"person.yaml",
cancellationToken: cancellationToken);
Prism.Save(person, "person.data", PrismFormat.Cbor);
var options = new PrismOptions
{
Compress = true,
EncryptionKey = RandomNumberGenerator.GetBytes(32)
};
byte[] encrypted = Prism.Serialize(person, options);
var decrypted = Prism.Deserialize<Person>(encrypted, options);
string json = Prism.ToJson(person);
string yaml = Prism.ConvertText(
json,
PrismFormat.Json,
PrismFormat.Yaml);
byte[] binary = Prism.Convert<Person>(
json,
PrismFormat.Json,
PrismFormat.Binary);
The unencrypted binary payload uses a reversible byte transformation.
Use AES-GCM for confidentiality and authentication, and manage the key separately from the document.
Formats and limitations
| Format | Main use |
|---|---|
| Prism Binary | Type-driven, compact payloads with strict schema matching, optional Brotli and AES-GCM |
| JSON | UTF-8 JSON objects, arrays, and values |
| XML | Prism's XML value vocabulary |
| YAML | Single-document YAML with string keys and a restricted scalar schema |
| TOML | TOML tables without null values or numeric precision loss on output |
| CBOR | Definite-length CBOR with byte strings, big integers, and decimal fractions |
Prism Binary is an alpha protocol. Changes to serialized member names or wire shapes affect schema compatibility.
Cycles require binary reference preservation and mutable contracts.
Each codec has representation limits, and conversion follows the shared value model.
Native AOT and trimming are unverified.
Architecture and contributions
Prism maps models through one cached contract system.
Format codecs then handle the shared value representation.
The binary codec uses the CLR schema to write positional values. Extensions can supply an application converter or a complete format codec.
Use the pinned SDK and install the four target runtimes.
Run the following from the repository root before opening a pull request.
dotnet restore
dotnet format --verify-no-changes --no-restore
dotnet build -c Release
dotnet test -c Release
dotnet pack -c Release -o artifacts
bash scripts/check-package.sh artifacts
Keep the binary fixture aligned with the protocol version and document wire changes.
Benchmark inputs, measured timings, allocations and payload sizes are available in the benchmark guide.
Benchmarks · Getting started · Publishing · MIT license
❤️ Support the project
Sunmeat.Prism is free, open-source software created and maintained by an independent developer.
If Prism saves you time, simplifies your code, or becomes a valuable part of your projects, consider supporting its continued development.
Your support helps fund:
- New features and serialization formats.
- Performance improvements and optimizations.
- Documentation, examples, and automated tests.
- Long-term maintenance and compatibility.
- New open-source .NET libraries and developer tools.
Every contribution, regardless of its size, makes a difference.
You can also support the project by starring the repository, reporting issues, contributing code, or sharing Prism with other developers.
Built with curiosity. Shared with the community.
Copyright © 2026 Oleksandr Zahoruiko · sunmeat.dev
| 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 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. |
-
net10.0
- System.Formats.Cbor (>= 10.0.15)
- Tomlyn (>= 2.11.1)
- YamlDotNet (>= 18.1.0)
-
net11.0
- System.Formats.Cbor (>= 10.0.15)
- Tomlyn (>= 2.11.1)
- YamlDotNet (>= 18.1.0)
-
net8.0
- System.Formats.Cbor (>= 10.0.15)
- Tomlyn (>= 2.11.1)
- YamlDotNet (>= 18.1.0)
-
net9.0
- System.Formats.Cbor (>= 10.0.15)
- Tomlyn (>= 2.11.1)
- YamlDotNet (>= 18.1.0)
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 |
|---|---|---|
| 1.0.2 | 113 | 11/29/2026 |
Fixed README rendering on NuGet.org.