Skip to main content

Introduction to JsonFlow

JsonFlow was created to solve the JSON problem in Object Pascal applications without compromise: speed, correctness, and ergonomics all at once.

Design pillars

1. Unified facade — TJsonFlow

TJsonFlow is a class-based facade (no instance required) that groups the most common operations:

  • TJsonFlow.ObjectToJsonString(AObject) — serialize any Delphi object to a JSON string.
  • TJsonFlow.JsonToObject<T>(AJson) — deserialize a JSON string back to a typed object.
  • TJsonFlow.Write — returns the shared IJSONWriter for building JSON programmatically.
  • TJsonFlow.Reader — returns the shared IJSONReader for parsing JSON strings or streams.

2. Dual-layer architecture

JsonFlow has two layers:

LayerPurpose
Core JSON layer (JsonFlow.Interfaces, JsonFlow.Value, JsonFlow.Objects, JsonFlow.Arrays)Low-level interface tree — IJSONElement, IJSONObject, IJSONArray, IJSONValue
Feature layer (JsonFlow.Serializer, JsonFlow.Composer, JsonFlow.Schema.*)High-level features built on top of the core layer

3. Interface-first

All JSON structures are accessed through interfaces (IJSONElement, IJSONObject, IJSONArray, etc.), which gives automatic lifetime management via reference counting in Delphi.

4. Middleware pipeline

Both serialization (read/write) and schema validation support a middleware pipeline. Implement IGetValueMiddleware or ISetValueMiddleware to intercept property values during serialization/deserialization (e.g., encrypt a field, reformat a date).

5. Audited performance

Every hot path was profiled and optimized in the July 2026 audit, validated with byte-identical output and reproducible console benchmarks:

Hot pathResult
Serialization / deserializationup to 26× faster than native Delphi TJSON; up to 15× faster than X-SuperObject
Schema validation3.4× faster (identity-based compile caching, precompiled regexes, O(1) error paths)
Path-based editingup to 33× faster (IJSONArray.Insert, reusable navigation)

Compatibility

EnvironmentPlatformDraft 7Custom Middlewares
Delphi XE or laterVCL, FMX, Console (Win/Linux/macOS/iOS/Android)YesYes
Platform status

Win32/Win64 is verified in production. All installed Delphi compilers build the full framework cleanly (verified 2026-07-07): Win32, Win64, Win64x (ARM64EC), Linux64, macOS Intel/ARM, iOS device/simulator.