Compze.Serialization.SystemTextJson
0.3.14-alpha
Prefix Reserved
See the version list below for details.
dotnet add package Compze.Serialization.SystemTextJson --version 0.3.14-alpha
NuGet\Install-Package Compze.Serialization.SystemTextJson -Version 0.3.14-alpha
<PackageReference Include="Compze.Serialization.SystemTextJson" Version="0.3.14-alpha" />
<PackageVersion Include="Compze.Serialization.SystemTextJson" Version="0.3.14-alpha" />
<PackageReference Include="Compze.Serialization.SystemTextJson" />
paket add Compze.Serialization.SystemTextJson --version 0.3.14-alpha
#r "nuget: Compze.Serialization.SystemTextJson, 0.3.14-alpha"
#:package Compze.Serialization.SystemTextJson@0.3.14-alpha
#addin nuget:?package=Compze.Serialization.SystemTextJson&version=0.3.14-alpha&prerelease
#tool nuget:?package=Compze.Serialization.SystemTextJson&version=0.3.14-alpha&prerelease
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,JsonArrayorJsonValuestore the JSON they hold. Declare a member asJsonNodewhen its CLR value can produce an object or an array. AJsonValuemember must produce a scalar. - Value types with a text representation — both serializers store a consumer type whose
TypeConverterconverts 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
Related packages
| 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 | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- Compze.Abstractions (= 0.8.0-alpha)
- Compze.Tessaging (= 0.25.0-alpha)
- Compze.Teventive (= 0.14.0-alpha)
- Compze.Teventive.TeventStore.Abstractions (= 0.10.0-alpha)
- Compze.TypeIdentifiers (= 0.6.1-alpha)
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 |
- **Requires exact versions of the Compze packages whose internals it uses:** Compze.Tessaging 0.25.0-alpha (was 0.24.0-alpha). Upgrading to this version upgrades each package listed here to exactly that version, so their changelogs apply to this upgrade as well.