O'Reilly logo

Delphi Cookbook by Daniele Teti

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Serializing objects to JSON and back using RTTI

When you are using a domain model pattern (and you should do most of the time for non-trivial applications), the entities managed by your program are contained in objects. An object has a state and methods to change its state, just like any actual object in the real world.

Getting ready

As the datasets in the previous recipe is very popular with the needs to serialize an object in a JSON object, send the object somewhere, and then recreate that object as it was before. In this recipe, we'll use the new TJSON class present in Delphi XE6 and will extend it with new functionalities.

How to do it...

Let's execute the following steps to serialize objects to JSON:

  1. Create a new VCL forms application.
  2. Drop four ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required