RabbitRpc.Serialization.SystemTextJson
4.0.0
dotnet add package RabbitRpc.Serialization.SystemTextJson --version 4.0.0
NuGet\Install-Package RabbitRpc.Serialization.SystemTextJson -Version 4.0.0
<PackageReference Include="RabbitRpc.Serialization.SystemTextJson" Version="4.0.0" />
<PackageVersion Include="RabbitRpc.Serialization.SystemTextJson" Version="4.0.0" />
<PackageReference Include="RabbitRpc.Serialization.SystemTextJson" />
paket add RabbitRpc.Serialization.SystemTextJson --version 4.0.0
#r "nuget: RabbitRpc.Serialization.SystemTextJson, 4.0.0"
#:package RabbitRpc.Serialization.SystemTextJson@4.0.0
#addin nuget:?package=RabbitRpc.Serialization.SystemTextJson&version=4.0.0
#tool nuget:?package=RabbitRpc.Serialization.SystemTextJson&version=4.0.0
RabbitRpc.Serialization.SystemTextJson
System.Text.Json IRpcSerializer adapter for RabbitRpc. One of three serialization adapters available for RabbitRpc 4.x — pick this one for JSON on the wire (debugging, legacy interop, or compatibility with v3 JSON payload shape). For high-throughput production traffic prefer a binary adapter.
Installation
dotnet add package RabbitRpc.Serialization.SystemTextJson
dotnet add package RabbitRpc.Client # or RabbitRpc.Server
Pack for NuGet
dotnet pack -c Release
This package is a sidecar to RabbitRpc.Client / RabbitRpc.Server — install one (or both) of those alongside it.
Configuration
Server:
using AsbtCore.Broker.Server;
using AsbtCore.Broker.Serialization.SystemTextJson;
services.AddRabbitRpcServer(configuration)
.UseJsonRpcSerialization()
.Register<IGreeter, GreeterService>();
Client:
using AsbtCore.Broker.Client;
using AsbtCore.Broker.Serialization.SystemTextJson;
services.AddRabbitRpcClient(configuration)
.UseJsonRpcSerialization()
.AddProxy<IGreeter>();
ContentType published on BasicProperties is application/json. Argument and result fragments are emitted as base64-encoded JSON strings.
Custom options
Both UseJsonRpcSerialization extensions accept an optional configure callback for tuning JsonSerializerOptions:
.UseJsonRpcSerialization(o =>
{
o.WriteIndented = false;
o.Converters.Add(new MyDomainConverter());
});
Base options are produced by RpcJson.Build() — camelCase, case-insensitive property matching, null-write skipped, plus the ReadOnlyMemoryByteJsonConverter. Call RpcJson.Build() directly if you need the defaults without DI.
DTO requirements
None beyond what System.Text.Json already requires. DTOs are reflected at runtime — plain classes, records, init-only properties, and IEnumerable<T> collections all work. No source generator, no Touch<T> call sites, no AOT-time codegen step.
Wire format & performance
- JSON envelope,
application/jsoncontent type. - Per-argument and per-result fragments are base64-encoded JSON strings — adds ~33 % size overhead vs raw bytes.
- Deserialization allocates a fresh
byte[]perReadOnlyMemory<byte>property; the contract guarantees decoded payloads remain valid after the source buffer is reused. - Not zero-copy. Throughput-sensitive workloads should use a binary adapter.
Limitations
- Base64-on-the-wire makes payloads larger and somewhat slower than v3 raw JSON — this is intentional, since v4 fragment payloads are arbitrary bytes (
ReadOnlyMemory<byte>), and base64 is the canonical JSON-safe encoding. - AOT/trim require manual
JsonSerializerContextregistration through the configure callback.
See Also
- RabbitRpc.Client — client-side library with typed proxies.
- RabbitRpc.Server — server-side library that hosts RPC implementations.
- RabbitRpc.Serialization.XPacketRpc — binary adapter (default since v4.0).
- RabbitRpc.Serialization.MemoryPack — MemoryPack binary adapter with reflection-friendly DTO discovery.
License
MIT
| Product | Versions 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. |
-
net10.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 |
|---|---|---|
| 4.0.0 | 94 | 5/15/2026 |
v4.0.0 — Unified release under the RabbitRpc 4.x line.
- First release of the SystemTextJson adapter against the IRpcSerializer v4 surface (SerializeEnvelope / DeserializeEnvelope / SerializeFragment / DeserializeFragment).
- Drop-in shape for v3 JSON wire — DTOs reflected at runtime, no source generator step.
- ReadOnlyMemoryByteJsonConverter emits per-fragment payloads as base64-encoded JSON strings.
- Compatible with RabbitRpc.Client 4.x and RabbitRpc.Server 4.x.