Home

Awesome

Delphi-JsonToDelphiClass

Fixes & Features: 16th June 2024

Features

Eg this JSON

{
    {
        "createdAt": null,
        "updatedAt": "2013-05-28T15:47:57.962Z",
        "username": "jacquelyn88"
    }
}

Generates the following DTO:

  TItems = class
  private
    FCreatedAt: string;
    [SuppressZero]
    FUpdatedAt: TDateTime;
    FUsername: string;
  published
    property CreatedAt: string read FCreatedAt write FCreatedAt;
    property UpdatedAt: TDateTime read FUpdatedAt write FUpdatedAt;
    property Username: string read FUsername write FUsername;
  end;

Fixes & Features: 04th February 2024

Features

This demo illustrates how to authenticate a user to obtain a Bearer token. Subsequently, this token is used to retrieve a list of products from an endpoint that requires authentication.

Thanks to DummyJSON for providing this service.

Fixes & Features: 01th February 2024

Features

Fixes & Features: 19th January 2024

Features

Bugs:

Fixes & Features: 13th January 2024

Features

Fixes & Features: 06th February 2022

Features

Fixes & Features: 23th December 2021

Features

Fixes & Features: 03th October 2021

Bugs:

Features

A Small example:

type
  TDateTimeDTO = class(TJsonDTO)
  private
    [SuppressZero]
    FSuppressDate: TDateTime;
    FNoSuppressDate: TDateTime;
  public
    property DateSuppress: TDateTime read FSuppressDate write FSuppressDate;
    property NoDateSuppress: TDateTime read FNoSuppressDate write FNoSuppressDate;
  end;

The above class will generate the following JSON, if both properties is 0

  {
    "suppressDate":"",
    "noSuppressDate":"1899-12-30T00:00:00.000Z"
  }

NOTE: You can turn off this feature in the settings form

Fixes & Features: 04th June 2021

Bugs:

Features

Fixes & Features: 26th Marts 2021

Bugs:

E.g this JSON generated faulty code:

{
    "/": {
        "readonly": true
    },
    "\\": {
        "readonly": true
    }
} 

Fixes & Features: 22th December 2020

Bugs:

Features

Fixes & Features: 11th December 2020

Bugs:

Features

Fixes & Features: 24th November 2020

Bugs:

Features

Fixes & Features: 22th November 2020

Bugs:

Features

Eg this JSON

{
   "ArrayTest":[
      {
           "S1":"5102"
      },
      {
           "S2":"True"
      }
   ]
}

Generates the following DTO:

  TArrayTestDTO = class
  private
    FS1: string;
    FS2: string;
  published
    property S1: string read FS1 write FS1;
    property S2: string read FS2 write FS2;
  end;

Previous changes

Generates Delphi Classes based on JSON string. Just like XML Data Binding, but for JSON.

Main features

*** The releases of JsonToDelphiClass (source and binaries) are public and reside on GitHub. The update unit uses GitHub's REST API to enumerate tags/releases.

Report any problems/suggestions using GitHub's facilities.