Skip to content
sunmeatPublic

About

One object. Any format. A unified .NET serialization API for Prism Binary, JSON, XML, YAML, TOML and CBOR.

Topics

Resources

Code of conduct

Contributing

Security policy

Accessibility

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Sunmeat.Prism logo

Sunmeat.Prism

One object. Any format.

Prism serializes ordinary C# objects as Prism Binary, JSON, XML, YAML, TOML, or CBOR through a single API.

NuGet CI MIT .NET Support development

Українська

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.

Compatibility

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.

Contract rules

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.

Security

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.

Options · Compatibility

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.

Architecture · Converters

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


Sunmeat ecosystem

Independent .NET libraries with a shared philosophy: simple APIs, modularity and open source.

Library Purpose NuGet / Status
Sunmeat.Prism (this project) Serialization and format conversion NuGet
Sunmeat.Pulse Structured logging NuGet
Sunmeat.Nexus HTTP requests and API communication NuGet
Sunmeat.Lens Code analysis and architecture visualization NuGet · Roslyn · Raster
Sunmeat.Guard Validation and argument checks NuGet
Sunmeat.Diff Data comparison and patches NuGet
Sunmeat.Morph Object mapping and transformation NuGet
Sunmeat.Forge Synthetic data and test fixtures NuGet
Sunmeat.Signal Multichannel notifications NuGet · Extensions.DependencyInjection
Sunmeat.Vault Cryptography and secret storage NuGet
Sunmeat.Portal File systems, storage and backups NuGet
Sunmeat.Scribe Document generation and processing In development
Sunmeat.Flux In-process Mediator, CQRS and Event Bus In development
Sunmeat.Synapse Unified AI API and model routing In development

All published packages · Ecosystem website


❤️ 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.

Support development Patreon Monobank Star on GitHub Developer website

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

About

One object. Any format. A unified .NET serialization API for Prism Binary, JSON, XML, YAML, TOML and CBOR.

Topics

Resources

Code of conduct

Contributing

Security policy

Accessibility

Stars

1 star

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages