Lyo.Common.Json
2.0.0
dotnet add package Lyo.Common.Json --version 2.0.0
NuGet\Install-Package Lyo.Common.Json -Version 2.0.0
<PackageReference Include="Lyo.Common.Json" Version="2.0.0" />
<PackageVersion Include="Lyo.Common.Json" Version="2.0.0" />
<PackageReference Include="Lyo.Common.Json" />
paket add Lyo.Common.Json --version 2.0.0
#r "nuget: Lyo.Common.Json, 2.0.0"
#:package Lyo.Common.Json@2.0.0
#addin nuget:?package=Lyo.Common.Json&version=2.0.0
#tool nuget:?package=Lyo.Common.Json&version=2.0.0
Lyo.Common.Json
The JSON contract Lyo APIs, clients, and message-queue envelopes serialize against lives in Lyo.Common.Json: camelCase properties, case-insensitive reads, nulls omitted on write, camelCase string enums, and ReferenceHandler.IgnoreCycles so EF-shaped graphs serialize without blowing up.
Converters under JsonConverters/ stay unregistered by default. They exist for vendor payloads that quote numbers or spell booleans as 0 / 1; add them per integration through LyoJsonSerializerOptionsBuilder.
Lyo.Common.Metadata is intentionally not referenced. The two converters that need registry records ship there, which keeps both packages acyclic. Namespaces match the package: options are Lyo.Common.Json.LyoJsonSerializerOptions and converters live in Lyo.Common.Json.JsonConverters.
Features
LyoJsonSerializerOptions.Create()returns a fresh options instance — safe to hand to DI or mutate further — andCreate(configure)applies a delegate to it.ApplyTo(target)copies the defaults onto an existing instance for ASP.NET Core'sConfigureHttpJsonOptions, which requires in-place mutation, and skips converters already present.LyoJsonSerializerOptionsBuilder. Fluent composition over the defaults, or over a supplied baseline:AddConverter,WithWriteIndented,WithDefaultIgnoreCondition, thenBuild()for a copy.ObjectJsonConverter. Opt-in STJ adapter overTypeConversion.FromJsonElement:objectproperties and collection items deserialize as CLR primitives (string, number, bool, list) instead ofJsonElement.- String-wrapped booleans.
StringIntBoolConverterand its nullable counterpart accept real JSON booleans, numbers, and quoted spellings alike. StringEnumConverter<TEnum>. Enum round-tripping for a specific enum type, for the cases where the suite-wideJsonStringEnumConverternaming policy is not what the upstream sends.StringDateTimeConverter. Constructed with the exact formats an integration uses (params string[] formats), for upstreams whose timestamps are not round-trippable.
Examples
Serialize against the shared contract
using Lyo.Common.Json;
var options = LyoJsonSerializerOptions.Create();
var json = JsonSerializer.Serialize(dto, options);
var back = JsonSerializer.Deserialize<MyDto>(json, options);
Apply the defaults to ASP.NET Core
using Lyo.Common.Json;
// ConfigureHttpJsonOptions hands you the live instance, so copy onto it rather than replacing it.
builder.Services.ConfigureHttpJsonOptions(o => LyoJsonSerializerOptions.ApplyTo(o.SerializerOptions));
A variant for one integration
using Lyo.Common.Json;
using Lyo.Common.Json.JsonConverters;
// This upstream quotes its numbers and sends booleans as 0/1.
var options = new LyoJsonSerializerOptionsBuilder()
.AddConverter(new StringIntConverter())
.AddConverter(new StringIntBoolConverter())
.AddConverter(new StringDateTimeConverter("yyyyMMdd", "yyyy-MM-dd HH:mm"))
.Build();
Why record converters live in the other package
SocialPlatformInfoJsonConverter and LanguageCodeInfoJsonConverter resolve a code to a registry record, so they would drag Lyo.Common.Metadata in behind them. Keeping them on the metadata side means a project that only wants the scalar converters does not acquire the catalogs, and neither package references the other.
Dependencies
Generated from ProjectReference / PackageReference (same model as docs/Lyo.ProjectGraph.html).
Lyo.Common.Core(direct, lyo)Lyo.Exceptions(direct, lyo)System.Text.Json10.0.5(direct, microsoft, netstandard2.0)Microsoft.Bcl.AsyncInterfaces10.0.5(transitive, microsoft, netstandard2.0)System.Memory4.6.3(transitive, microsoft, netstandard2.0)
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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 was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Lyo.Common.Core (>= 2.0.0)
- Lyo.Exceptions (>= 2.0.0)
- System.Text.Json (>= 10.0.5)
-
net10.0
- Lyo.Common.Core (>= 2.0.0)
- Lyo.Exceptions (>= 2.0.0)
NuGet packages (18)
Showing the top 5 NuGet packages that depend on Lyo.Common.Json:
| Package | Downloads |
|---|---|
|
Lyo.Query.Models
Query models for building and representing queries - QueryNode, QueryRequest, ConditionNode, SortBy, builders. Shared by Lyo.Query and Lyo.Api. |
|
|
Lyo.Web.Components
Blazor components library for the Lyo web UI framework with MudBlazor integration. |
|
|
Lyo.MessageQueue
Message queue service interface and base implementation for asynchronous messaging. |
|
|
Lyo.Api
Core API library for building RESTful APIs with Entity Framework Core, caching, and mapping support. |
|
|
Lyo.Config
Typed configuration definitions and per-entity bindings using flexible EntityRef references and JSON-backed values. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.0 | 429 | 9/9/2026 |