.XML, .JSON, .INI ? What to choose for configuration file. lazarus / 21-General ---------------------------------------------------------------------- BSaidus · 2022-11-14 12:00 Hello. I wonder, what is the best format you advise me, to save configuration of my application. the configuration file is big and containes many blocks ( blocks under blocks ). The .INI file will not be suitable for my needs. So I ask about .JSON and .XML. for XML I do not have any experience manipulating theme using Lazarus, and do not know if there is a wrapper classes for manipulating the elements in transparent way. In Json there is the TJSConfig class, It is good but it lakes loading data from stream instead file. Thank you in advence. ---------------------------------------------------------------------- jamie · 2022-11-14 12:04 if you want a Json then use a TFileStream class and give that to it as the stream ---------------------------------------------------------------------- Zvoni · 2022-11-14 12:14 If you have (complex) configuration-attributes to set and save, a filebased Database (SQLite) might be an option. In the end, everything is a file. Just the access to it is different ---------------------------------------------------------------------- marcov · 2022-11-14 12:37 I use an own fork of the laz_xml* XML files in most my work projects. The reasons for the own fork are mostly historic. (in the distant past we had to process and generate certain non compliant XMLs). INI has problems with nesting, so I would avoid it for anything but the simplest stuff. JSON can also be used as configuration, I did that for the generator of the FPC site in the website repostory: https://gitlab.com/freepascal.org/fpc/website (adp2html but the json stuff is in unit adpdata) ---------------------------------------------------------------------- VTwin · 2022-11-14 14:21 I was using some hand rolled XML code. That worked fine, but the files were getting rather large. I switched to json which seems more compact and readable. I use fpjson and jsonparser. I recall having some i18n issues with floats, but maybe that was me. ---------------------------------------------------------------------- lainz · 2022-11-14 14:24 Why nesting if you can put anything in the header of the config with INI files? Quote[Level1] a=1 [Level1.Level2] b=2 [Level1.Level2.Level3] c=3 ---------------------------------------------------------------------- BSaidus · 2022-11-16 19:59 Thanks you guys for all your responses. I will continue with .Json format since it is easely manageable with php in the server side and with lazarus for client part. ---------------------------------------------------------------------- KodeZwerg · 2022-11-16 20:16 When I am unsure what to pick I most often stop at saving configs in a binary/record/class way. The only problem you will have with that technique is when you add more things to be saved, it will enforce you to write a fresh config file. Also for a little security/safety you can easy encrypt each record/class/property in a different way... just saying that such methods still in 2022 exist