Compze.Serialization.SystemTextJson 0.3.18-alpha

Prefix Reserved
This is a prerelease version of Compze.Serialization.SystemTextJson.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Compze.Serialization.SystemTextJson --version 0.3.18-alpha
                    
NuGet\Install-Package Compze.Serialization.SystemTextJson -Version 0.3.18-alpha
                    
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="Compze.Serialization.SystemTextJson" Version="0.3.18-alpha" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Compze.Serialization.SystemTextJson" Version="0.3.18-alpha" />
                    
Directory.Packages.props
<PackageReference Include="Compze.Serialization.SystemTextJson" />
                    
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 Compze.Serialization.SystemTextJson --version 0.3.18-alpha
                    
#r "nuget: Compze.Serialization.SystemTextJson, 0.3.18-alpha"
                    
#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 Compze.Serialization.SystemTextJson@0.3.18-alpha
                    
#: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=Compze.Serialization.SystemTextJson&version=0.3.18-alpha&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Compze.Serialization.SystemTextJson&version=0.3.18-alpha&prerelease
                    
Install as a Cake Tool

Compze.Serialization.SystemTextJson

System.Text.Json serialization support for the Compze framework.

What is Compze?

Compze is a .NET framework for building expressive domains through Teventive programming and Typermedia APIs. Learn more

What's in this package?

This package provides Compze's serializer on System.Text.Json. It writes and reads the same JSON as Compze.Serialization.Newtonsoft, under the same rules:

  • Type renaming without broken data — a value's type is stored as its type map identity, never its .NET name
  • Strict reading — a stored member the type no longer has fails the read, unless [RemovedMembers("…")] names it
  • Inline JSON — members declared as JsonElement, JsonDocument, JsonNode, JsonObject, JsonArray or JsonValue store the JSON they hold. Declare a member as JsonNode when its CLR value can produce an object or an array. A JsonValue member must produce a scalar.
  • Value types with a text representation — both serializers store a consumer type whose TypeConverter converts to and from strings as its invariant text, including dictionary keys. Declare a member holding such a value as its own type so the reader knows which converter restores it.
  • Custom JSON converters — both serializers honour System.Text.Json's string-enum converter. A consumer's own JSON converter defines the JSON it handles directly, including type identifiers and checks for unknown members. Newtonsoft needs a matching converter to write that format.
  • The registrars — SystemTextJsonSerializer() fills the one serializer parameter an endpoint takes and the pure client's; the per-component registrars fill Tessaging's, Typermedia's, the tevent store's, the document db's and the taggregate snapshots' serializers

C# union members

Declare a member or collection item as its C# union type. Both Compze serializers write the active value's canonical TypeId in $type and serialize the value itself in $value. For example, a Destination(StreetAddress, CollectAtDepot) has these representations.

{"$type":"61757900-fd80-45c1-8c31-e33e1db5ab01, 0","$value":{"Street":"High Street"}}
{"$type":"61757900-fd80-45c1-8c31-e33e1db5ab02, 0","$value":{}}

Map the concrete case type as usual. Keeping its mapping preserves stored data across a rename. A statically declared union needs no mapping of its own unless it is itself another union's active value or part of a mapped generic identity. The same envelope holds primitive, collection and nested union cases. Consumer types need no JSON attributes.

A member declared as a custom [Union] class can also hold JSON null, which reads back as a null reference. Reading a required union member fails if the member is missing, including when a constructor restores it.

The write fails at the member if a union instance has no active case, its active type has no identity, two cases accept that type, or the member holds the union behind object or an interface. Reading a union instance requires the envelope and a payload that matches its identified case.

Installation

dotnet add package Compze.Serialization.SystemTextJson
Package Description
Compze.Serialization.Newtonsoft The same serializer on Newtonsoft.Json
Compze.Tessaging The endpoints whose serializer parameter this package fills
Compze.Teventive.TeventStore The tevent store whose serializer this package provides
Compze.DocumentDb The document db whose serializer this package provides

License

Apache-2.0

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
0.4.7-alpha 0 12/5/2026
0.4.6-alpha 0 12/5/2026
0.4.5-alpha 0 12/5/2026
0.4.4-alpha 0 12/5/2026
0.4.3-alpha 0 12/5/2026
0.4.2-alpha 9 12/5/2026
0.4.1-alpha 29 12/5/2026
0.4.0-alpha 57 12/5/2026
0.3.19-alpha 59 12/5/2026
0.3.18-alpha 59 12/5/2026
0.3.17-alpha 102 12/4/2026
0.3.16-alpha 71 12/4/2026
0.3.15-alpha 70 12/4/2026
0.3.14-alpha 62 12/4/2026
0.3.13-alpha 58 12/4/2026
0.3.12-alpha 56 12/4/2026
0.3.11-alpha 53 12/4/2026
0.3.10-alpha 69 12/3/2026
0.3.9-alpha 91 12/3/2026
0.3.8-alpha 53 12/3/2026
Loading failed

- **Requires exact versions of the Compze packages whose internals it uses:** Compze.Tessaging 0.26.1-alpha (was 0.26.0-alpha). Upgrading to this version upgrades each package listed here to exactly that version, so their changelogs apply to this upgrade as well.