Convert INI Files To JSON And Back With XSuperObject In Delphi XE6 Firemonkey On Android And IOS

Delphi XE6 Firemonkey JSON IniFile Parse Convert TranslateOne of the useful settings storage components that comes with Delphi XE6 Firemonkey is TIniFile (and TMemIniFile). The format of an INI file is basically sections that contain name value pairs. You can have multiple sections and then multiple name value pairs in each section. In order to make the data you are storing in INI files more versatile you may want to be able to convert your INI file format into JSON format and back again. I use the XSuperObject library for handling the JSON half of the conversion because it works on Android, IOS, OSX, and Windows. It should also work in Delphi XE5 and AppMethod as well. There have been some updates to XSuperObject as of early May 2014 so if you have an earlier version you should update it. Here are four functions which will do the conversion for you. Two of them are for reading and writing a JSON array to and from an IniFile and two of them are for reading and writing a JSON object to and from an IniFile. The functions are not veriy extensive because they really only handle one layer of JSON objects. If you want to handle more than one layer or if you want to handle subsections in INI files you’ll have to extend the functions yourself. Additionally, the functions support a limited number of datatypes but I usually just use strings everywhere in my INI files and JSON data.

Head over and download the latest version of XSuperObject which is required to use the JSON to INI file functions.

Have Delphi Firemonkey questions? Ask and get answers on StackOverflow.

Convert INI Files To JSON And Back With XSuperObject In Delphi XE6 Firemonkey On Android And IOS by Delphi XE5 XE6 XE7 XE8 10 Seattle Berlin Firemonkey, Delphi Android, Delphi IOS is licensed under a Creative Commons Attribution 4.0 International License.

One Response to Convert INI Files To JSON And Back With XSuperObject In Delphi XE6 Firemonkey On Android And IOS

  1. Pingback: Automatically JSON Serialize A DataSet For REST In Delphi XE6 Firemonkey On Android And IOS | Delphi XE5 XE6 Firemonkey, Delphi Android, Delphi IOS

Leave a Reply

Show Buttons
Hide Buttons
Read previous post:
Delphi XE6 Firemonkey Control Grid Screen Layout
Build A Grid Layout Screen For Your App With Delphi XE6 Firemonkey On Android And IOS

Sarina DuPont from Embarcadero has a blog post up where she shows how to use the TGridPanelLayout component in Delphi...

Close