forked from PKGeorgiev/Delphi-JsonToDelphiClass
-
Notifications
You must be signed in to change notification settings - Fork 23
Features
Jens Borrisholt edited this page Aug 14, 2026
·
1 revision
- Generates a complete Delphi unit or C# source file from a JSON object or array.
- Supports nested objects, scalar arrays, object arrays, nested arrays, and two-dimensional matrices.
- Reuses compatible object models and merges fields found across array elements.
- Produces valid target-language identifiers and escapes or transforms reserved words.
- Supports configurable class and property naming.
- Emits the imports/usings required by the inferred types.
-
Integer:
IntegerorInt64in Delphi;intorlongin C#. -
Fractional number:
Doublein Delphi;doublein C#. -
Boolean:
Booleanin Delphi;boolin C#. -
String:
stringin both languages. -
ISO date:
TDatein Delphi;DateOnlyin C#. -
ISO date-time:
TDateTimein Delphi;DateTimein C#. -
ISO time:
TTimein Delphi;TimeOnlyin C#. -
GUID string:
TGUIDin Delphi;Guidin C#. -
URI string:
TURIin Delphi;Uriin C#. - Null: merged with other observations and represented through the model's nullability information.
Numeric observations are promoted when compatible. Nullability is propagated through arrays, including nested arrays. More than two array dimensions are currently rejected.
- Delphi collections use
TList<T>orTObjectList<T>with generated lifetime-management code. - Scalar matrices use
TMatrix<T>. - Object matrices use
TObjectMatrix<T>, which owns row lists and their contained objects. - C# matrices use a generated
Matrix<T>based onList<List<T>>and work withSystem.Text.Json. - Jagged row lengths are allowed; conflicting leaf types are diagnosed.
Generated Delphi classes inherit from TJsonDTO. The runtime provides:
-
AsJsonfor serialization and deserialization; -
Clone<T>through a JSON round trip; - generic list reflection without leaking internal list implementation details;
- optional JSON-name attributes;
- zero-date suppression through
[SuppressZero]; - explicit object-matrix load/save support;
- ISO-8601 date handling and pretty printing.
The VCL application provides:
- simultaneous selectable Delphi, C#, BSON, and minified-JSON outputs;
- syntax highlighting appropriate to the selected language;
- JSON formatting and file open/save commands;
- JSON structure visualization;
- bundled demo-data browser;
- VCL or FMX demo-project generation using the current JSON;
- settings dialogs for both language backends;
- path-aware error selection in the JSON editor;
- asynchronous GitHub release checks.
- Input must have an object or array at the root.
- An empty array has no observable element type; generation can only use an unknown placeholder until a type is available.
- Arrays deeper than two dimensions are not supported.
- Semantic string detection is intentionally conservative and based on recognizable date, time, GUID, and URI formats.