Skip to content

Releases: JensBorrisholt/Delphi-JsonToDelphiClass

Version 3.2

30 Jan 15:18
9c2da4e
Compare
Choose a tag to compare

Features

  • Major code cleanup, especially naming
  • Removed INDY from Upgrade chekker
  • Forward classes are only generated if there are more than one thanks to Daniel for pointing this out

Version 3.1

20 Jan 06:16
2e119a4
Compare
Choose a tag to compare

Features

  • Upgrade to Delphi 12
  • Added Clone function on TJsonDTO class
  • More interceptors where published in a new repo: https://github.com/JensBorrisholt/Json-Interceptors
  • Added the possibility to download Pkg.Json.DTO.pas from www.Json2Delphi.com
  • Added ASP.NET interface: www.Json2Delphi.com
  • Source code included
  • New property attribute : [SuppressZero]
    Delphi doesn't support Nullable types, so use this attribute to strip TDateTime property where value is 0.
    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

  • Added unit tests for updating elements in lists.

Bugs:

  • Unittest TestDateTime didnt pass under Delphi 12
  • Added missing Reserved words
  • Wrong type detection. '2019-08-29' wasn't recognized as a Date, but a string
  • All unittests didn't pass
  • In the generator main form, the correct JSON wans't allways read from the MEMO
  • In the generator main form, the JSON wasn't allways updated
  • An error message occured when switching between the diffrent demo files
  • Dates without timestamp wasn't recognized within the RegEx
  • Compile error in unit tests
  • Updated elements in a list wasn't applied to the generated json.
  • Issue #2 Out of memory error and High CPU usage - Thank You MarkRSill
  • The same class name could appear multiple times:

E.g this JSON generated faulty code:

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

Version 3.0

22 Dec 14:51
fc2f304
Compare
Choose a tag to compare

Bugs:

Features

  • New main form. Completly rewritten.
  • Support for BSON
  • Support for Minify JSON
  • Support for multiblt output formats
  • JSON are now minifyed before posted to the validator. Means support for larger JSONs to be validated.
  • Version 3.0 released.

Fixes & Features: 11th December 2020

Bugs:

  • "id": "01010101" faulty generated a TDateTime property not string.
  • Settings.AddJsonPropertyAttributes didn't generate a Property Attribute

Features

  • JSON are now posted directly to the validator
  • Better property name generator
  • More unit tests

Fixes & Features: 24th November 2020

Bugs:

Features

  • Possibility to change the postfix of ClassNames, via Settings Dialog. Default: DTO
  • Settings Dialog rewritten to use LiveBindings
  • Create a Demo Project, using your Json Data

Fixes & Features: 22th November 2020

Bugs:

  • Demo generator didn't allways generate valid code
  • Stopped the generator from generating surplus classes.

Features

  • Non object arrays are now mapped into a TList instead of TArray
  • Added a settings dialog and settings class
  • Properties in PascalCase (Setting)
  • Allways use JsonName property annotation (Setting)
  • Support for objects with diffrents properties in an Array

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;

Major release

02 Aug 09:22
Compare
Choose a tag to compare

Bugfixes

  • GenericListReflect attribute could raise an AV
  • The DTO could leak memory if you didn't ask for all lists
  • A floating point number inside a string was recognized as a Boolean
  • The JSONName annotation wasn't always applied when needed
  • JSON Keys starting with a number didn't generate valid code
  • The internal Array was marshalled when converting the DTO to JSON

New Features

  • Support for Empty Anonymous Array
[ ]
  • Support for array with simple types (non object)
  {
      "property":[
        "Test 1",
        "Test 2"
      ]
  }
  • Array merging. When the objects of an Array contains different properties, this is merges into one object structure:

JSON:

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

DTO

  TItemsDTO = class
  private
    FS1: string;
    FS2: Boolean;
  published
    property S1: string read FS1 write FS1;
    property S2: Boolean read FS2 write FS2;
  end;
  • Date and time, with optional fractional seconds and time zone (e.g., 2008-08-30T01:45:36 or 2008-08-30T01:45:36.123Z) are detected.
  • Added a lot of Demo data
  • The program can now generate a demo project using your JSON
  • More Reserved Words are recognized
  • Better naming of Delphi properties eg. firstrname becomes FirstName, was Firstname

The Code

  • Heavy core-restructure in order to make the classes more loosely bind
  • GetJsonType has been isolated in order for it to be unit tested
  • TJSONName.CapitalizeFirst has been made public in order for it to be unit tested
  • Added unit test og central part of the code. More to come
  • Added End 2 End test for all demo data files

First major release

13 Jan 18:25
Compare
Choose a tag to compare

This is the first major release since the fork

Lots of changes in this version:

  • Only floating poiunt numbers are mapped to Double
  • Numbers are mapped to Integer or Int64 depending on their size
  • Generated code restructored, and simplified
  • Generated classes inheriteds from TJsonDTO
  • Socurce Code restructored
  • Parser logic are seperated from GUI logic
  • Fixed bug in the RegEx for recognizing an ISO8601 Date
  • Added support for JSON starting with an Array
  • Added support for [JSONName] annotations