JSON to Delphi Classes
I’m currently working on a new blog post showing how to integrate a popular REST API. One of my tasks is to convert JSON to Delphi Objects, so I need to define the Delphi class structures to work with so I can use the TJSON.JSONToObject that I covered previously. I decided to see if anyone had done work to convert JSON into Delphi classes.
Thankfully YES! I found this really handy project JsonToDelphiClass on GitHUB by Petar Georgiev. The project in covered in the post Introducing JsonToDelphiClass.
The JSON to Delphi Project is a Delphi FMX application that has a simple UI that allows you to modify the automatically created JSON class names which is pretty useful and the code worked first time when copied into my sample. (although I have more playing to do)
The JSON to Delphi tool is definitely a useful resource to work alongside the REST Debugger that you can find in the BIN directory of your RAD Studio install.
Stay tuned for the blog post when it arrives, but in the mean time, if your working with the REST components, I would recommend checking out Petar’s project along side my earlier post on Integrating Microsoft Azure Translation Services into Delphi.