Skip to main content

SystemTextJsonOptions

Namespace: Meshmakers.Octo.Sdk.Common.EtlDataPipeline

The OctoMesh ETL pipeline System.Text.Json options. A thin pipeline-flavored override of the canonical Rt-model serializer (octo-construction-kit-engine, Runtime.Contracts/Serialization/, next to RtNewtonsoftSerializer).

public static class SystemTextJsonOptions

Inheritance Object → SystemTextJsonOptions

Remarks:

The converter family (CK/Rt id converters + RtAttributesConverter), case-insensitive property matching, and lenient number handling all come from . This bundle changes two things for the pipeline:

Null preservation. drops null properties (matching the legacy RtNewtonsoftSerializer). The pipeline instead preserves explicit nulls () so node code can distinguish "intentionally null" from "absent": GetKind("$.x") returns DataKind.Null for the former and DataKind.Undefined for the latter, and patch / CK-mutation semantics depend on that distinction end-to-end.

Integer coercion.NewtonsoftParityInt32Converter and NewtonsoftParityInt64Converter are the read-side twins of the .0-emitting NewtonsoftParityDouble/Single/DecimalConverter that registers. Without them the built-in Int32/Int64 converters reject the literal 5.0 on its raw text, so every "a node wrote a double, a later node reads it as Int" pipeline failed (AB#5275). See NewtonsoftParityInt32Converter for the coercion rules; the dynamic boxing path (JsonScalar.ToClr behind IDataContext.GetValue()) is deliberately unaffected.

Per-call null-strip override. A wire-format consumer that needs nulls dropped can copy and flip the condition locally rather than mutating this bundle:

var wireOptions = new JsonSerializerOptions(SystemTextJsonOptions.Default)
{
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
};
JsonSerializer.Serialize(dto, wireOptions);

Fields​

Default​

Shared default options instance used across the pipeline, mesh-adapter, and downstream plugins that round-trip CK runtime types through System.Text.Json. Preserves explicit nulls.

public static JsonSerializerOptions Default;

NodeNavigation​

Options for constructing the DataContext's document tree — identical to SystemTextJsonOptions.Default EXCEPT is false, so JsonObjects built via this bundle navigate property names case-sensitively (Newtonsoft JObject / JSONPath SelectToken parity).

public static JsonSerializerOptions NodeNavigation;

Remarks:

Newtonsoft's behavior is split: document navigation (the JObject indexer and SelectToken) is case-SENSITIVE, while typed ToObject<T> CLR-member binding is case-INSENSITIVE. The pipeline matches both by using THIS bundle only for the element→node bridge that produces the navigable document tree (see JsonDetach.ToNode and the CLR→node path of DataContextImpl.Set<T>), while typed Get<T> (Deserialize<T>) keeps using the case-insensitive SystemTextJsonOptions.Default. The CK-engine runtime types (EntityUpdateInfo<T>, RtEntity, RtRecord, RtAssociation) have camelCase [JsonConstructor] parameters bound against PascalCase wire keys, so their typed binding REQUIRES case-insensitivity — which is why the flag is split here rather than flipped on SystemTextJsonOptions.Default. All other settings (converters, encoder, number handling, null preservation) are inherited unchanged from SystemTextJsonOptions.Default.

Methods​

CreateDefault()​

Creates a fresh pipeline options instance: the default with null preservation enabled. Callers needing further overrides start from this and copy.

public static JsonSerializerOptions CreateDefault()

Returns​

JsonSerializerOptions

CreateNodeNavigation()​

Creates a fresh document-node-construction options instance: SystemTextJsonOptions.CreateDefault() with case-sensitive property matching. JsonNodes deserialized under these options carry JsonNodeOptions.PropertyNameCaseInsensitive == false, making their TryGetPropertyValue/indexer navigation case-sensitive (Newtonsoft JObject parity).

public static JsonSerializerOptions CreateNodeNavigation()

Returns​

JsonSerializerOptions