AyCode.Core/AyCode.Core/Serializers/Jsons
Loretta 17daf0fef2 Document AcBinary wire format, sync docs, update conventions
- Add BINARY_FORMAT.md: full AcBinary wire format spec (markers, encoding, options, protocol, interactions)
- Reference BINARY_FORMAT.md from GLOSSARY.md, Binaries/README.md, and Serializers/Binaries/README.md; add new glossary terms
- Clarify and expand config options tables to match new doc
- Add/clarify LLM maintenance rules: always sync .md files with code, auto-fix discrepancies
- Update root README.md: AyCode.Core targets .NET 9, not 10; stress doc/code sync
- Add code reuse and doc sync conventions to copilot-instructions.md and CONVENTIONS.md
- Add docs/ folder and BINARY_FORMAT.md to solution as Solution Items
- Minor clarifications and cross-links in ARCHITECTURE.md and other docs
2026-03-29 09:11:57 +02:00
..
AcJsonContextBase.cs Refactor: unify metadata and tracking for serializer contexts 2026-01-18 15:31:45 +01:00
AcJsonDeserializationException.cs Refactor serialization reference tracking and contexts 2026-01-17 10:06:46 +01:00
AcJsonDeserializer.JsonDeserializationContext.cs Reduce pool sizes, optimize IdentityMap, add config option 2026-01-31 17:17:51 +01:00
AcJsonDeserializer.JsonDeserializeTypeMetadata.cs Refactor: unify metadata and tracking for serializer contexts 2026-01-18 15:31:45 +01:00
AcJsonDeserializer.JsonElement.cs Refactor list factory to support capacity for deserialization 2026-02-02 19:02:17 +01:00
AcJsonDeserializer.Primitives.cs Add expression serialization & chain API for JSON deserialization 2025-12-29 15:28:46 +01:00
AcJsonDeserializer.Utf8Reader.cs Refactor list factory to support capacity for deserialization 2026-02-02 19:02:17 +01:00
AcJsonDeserializer.cs Reduce pool sizes, optimize IdentityMap, add config option 2026-01-31 17:17:51 +01:00
AcJsonSerializer.JsonSerializationContext.cs Reduce pool sizes, optimize IdentityMap, add config option 2026-01-31 17:17:51 +01:00
AcJsonSerializer.JsonSerializeTypeMetadata.cs Refactor: unify metadata and tracking for serializer contexts 2026-01-18 15:31:45 +01:00
AcJsonSerializer.cs High-perf IId tracking: custom IdentityMap, async cleanup 2026-01-30 18:12:45 +01:00
AcJsonSerializerOptions.cs Refactor serializer options, string fast paths & analysis 2026-01-25 16:40:40 +01:00
JsonPropertyAccessorBase.cs Refactor: Add high-performance Chain API for serializers 2025-12-29 22:41:28 +01:00
JsonPropertySetterBase.cs Refactor serialization infra, add perf benchmarks 2025-12-30 19:29:39 +01:00
MergeContractResolver.cs
README.md Document AcBinary wire format, sync docs, update conventions 2026-03-29 09:11:57 +02:00

README.md

Jsons

Custom JSON serialization/deserialization built on System.Text.Json's Utf8JsonWriter/Utf8JsonReader, optimized for IId reference handling and polymorphic types.

Architecture

  • Reference scanning phase (pre-visit) detects multi-referenced objects before serialization.
  • Uses $id/$ref JSON properties for circular reference handling (JSON standard).
  • Polymorphic type hints via typename property.
  • Context pooling for allocation efficiency.

Key Files

Serialization

  • AcJsonSerializer.cs — Main serializer entry point, context pool management.
  • AcJsonSerializer.JsonSerializationContext.cs — Core serialization logic with Utf8JsonWriter.
  • AcJsonSerializer.JsonSerializeTypeMetadata.cs — Cached type metadata for serialization.
  • AcJsonSerializerOptions.cs — Configuration and presets.

Deserialization

  • AcJsonDeserializer.cs — Main deserializer entry point.
  • AcJsonDeserializer.JsonDeserializationContext.cs — Core deserialization logic.
  • AcJsonDeserializer.JsonDeserializeTypeMetadata.cs — Cached type metadata for deserialization.
  • AcJsonDeserializer.JsonElement.csJsonElement processing.
  • AcJsonDeserializer.Primitives.cs — Primitive type conversions.
  • AcJsonDeserializer.Utf8Reader.csUtf8JsonReader operations.

Supporting

  • AcJsonContextBase.cs — Base context shared between serializer and deserializer.
  • JsonPropertyAccessorBase.cs — Property accessor for serialization.
  • JsonPropertySetterBase.cs — Property setter for deserialization.
  • MergeContractResolver.cs — Contract resolution for merge/populate operations.
  • AcJsonDeserializationException.cs — Rich exception with JSON context, type info, and original exception.

Configuration

Option Description
ReferenceHandling All required — OnlyId not fully implemented for JSON
MaxDepth Maximum object graph depth
ThrowOnCircularReference Throw vs silently handle circular refs

Presets: Default (with refs), ShallowCopy, WithMaxDepth, WithoutReferenceHandling.

Dependencies

  • Base classes from parent Serializers/ folder
  • System.Text.Json (Utf8JsonWriter, Utf8JsonReader, JsonElement)