A complete LiveBindings-enabled component for Delphi that allows you to bind JSON data to visual controls using the LiveBindings framework.
- Design-Time Schema Configuration: Configure JSON schema via context menu "Configure Schema"
- Design-Time Data Entry: Set JSON data via context menu "Set Data"
- Runtime Data Binding: Use
SetData()method to bind data at runtime - LiveBindings Integration: Works seamlessly with Delphi's LiveBindings designer
- Type Support: Supports string, integer, float, and boolean types
- FMX Compatible: Works with FireMonkey applications
- Open
Packages\JsonBindSourceRT.dpkin Delphi - Right-click on the project and select "Build"
- The package will be compiled but not installed (runtime-only)
- Open
Packages\JsonBindSourceDT.dpkin Delphi - Right-click on the project and select "Build"
- Right-click on the project and select "Install"
- The component will appear in the "LiveBindings" palette
- Drop a
TJsonBindSourcecomponent on your form - Right-click the component and select "Configure Schema..."
- Enter your JSON schema (or click "Load Sample")
- Right-click the component and select "Set Data..."
- Enter your JSON data (or click "Load Sample")
- Open the LiveBindings designer
- Create bindings from the JSON fields to your visual controls
The component supports two schema formats:
{
"fields": [
{"name": "id", "type": "integer"},
{"name": "name", "type": "string"},
{"name": "email", "type": "string"},
{"name": "age", "type": "integer"},
{"name": "salary", "type": "float"},
{"name": "active", "type": "boolean"}
]
}{
"id": "integer",
"name": "string",
"email": "string",
"age": "integer",
"salary": "float",
"active": "boolean"
}Both formats are automatically recognized and converted internally. The short format is more concise and convenient for simple schemas.
// Configure schema at runtime
JsonBindSource1.JsonSchema.Text := '{"fields": [...]}';
// Set data using the SetData method
var
JsonData: string;
begin
JsonData := '{"id": 1, "name": "John Doe", "email": "john@example.com"}';
JsonBindSource1.SetData(JsonData);
JsonBindSource1.Active := True;
end;
// Clear data
JsonBindSource1.ClearData;The Demo folder contains a complete FMX application demonstrating the component usage:
- Open
Demo\JsonBindSourceDemo.dprojin Delphi - Run the application
- Click "Load Data" buttons to see LiveBindings in action
TJsonBindSource/
├── Source/
│ ├── JsonBindSource.pas # Main component (runtime)
│ ├── JsonSchemaEditor.pas # Schema configuration dialog
│ ├── JsonSchemaEditor.fmx # Schema editor form
│ ├── JsonDataEditor.pas # Data entry dialog
│ ├── JsonDataEditor.fmx # Data editor form
│ └── JsonBindSourceReg.pas # Design-time registration
├── Packages/
│ ├── JsonBindSourceRT.dpk # Runtime package
│ └── JsonBindSourceDT.dpk # Design-time package
└── Demo/
├── JsonBindSourceDemo.dpr # Demo application
├── MainForm.pas # Main form
└── MainForm.fmx # Main form layout
- Delphi 10 Seattle or later (RAD Studio 19.0+)
- FireMonkey (FMX) framework
- LiveBindings components
The component is based on TBaseObjectBindSource and implements a custom adapter (TJsonBindSourceAdapter) that:
- Parses JSON schema to define fields
- Parses JSON data and exposes values through LiveBindings
- Supports the standard LiveBindings member getter interface
- Integrates with the LiveBindings designer
Boost Software License - Version 1.0