11
votes
Vote UpVote

How to convert an object to JSON and back with a single line of code

Stephen Ball – Ever wanted to take an Object into a format that is easily persisted and back? Well now you can. New in XE6 is the REST.JSON unit. This allows you access to TJSON a class with some very helpful class methods. Using TJSON you can convert an object to a JSON string and back with a little help from generics along the way. The following code uses a class called TFoo that has a Foo and a Fee property (string and Integer) Using TJson you can then see how to covert the object to a string and back ready for storage, transport etc. uses REST.JSON; // Also new System.JSON procedure ...
Favorite? Off-Topic? Stephen Ball @ 2014-06-05 12:48

Statistics

Visits: 3811
Votes: 11
Favorites: 1
Off-Topic: 0

Visits by Source

User Actions

Users who voted for this posting

Alister Christie
Andreas Schachtner
GregB
jensgott
Marco Cirinei
NickHodges
Radosław Kokoć
Ravaut123
Rodrigo
SimaWB
Yanniel
Subscribe:
Contact us to advertise on DelphiFeeds.com

Community Links

Torry Firebird News

Sponsor

 
Please login or register to use this functionality.
(click on this box to dismiss)