Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
satyanarayana143 last edited by
hi freinds i want write array of json value to QSettings ini file
[ "ID": 570, "picture": "03803.png", "name": "Bob"]
how to write to QSettings file. any example
Read documentation, there are examples: https://doc.qt.io/qt-5/qsettings.html
Also, QSettings does not use JSON format.
beecksche last edited by beecksche
JonB last edited by
For an example of how to save JSON via
QSettingsyou might read through https://stackoverflow.com/questions/42060573/save-ui-settings-with-qsettings-or-qjson.
There are known issues with
QSettingswhich might occur with a JSON entry. Also, your JSON will probably have newlines in it, I don't know whether
QSettingshandles this for you (I think settings entries in the file have to be on one line), and/or "special" characters in the JSON which just might trip
If it all works as-is, fine. If not, just be aware that you could always use https://doc.qt.io/qt-5/qbytearray.html#toBase64 to encode the JSON before saving, and https://doc.qt.io/qt-5/qbytearray.html#fromBase64 to decode upon reload, if required and that solves issues.