Hi,
I have been trying to figure out how to read a JSON file using Qt5 QJsonDocument with no success so far.
I can't find any examples online. If someone could give me a simple example I would appreciate it.
Here is my code::
Qt Code:
QFile file; file.setFileName("/tmp/settings.json"); QJsonDocument settdoc; settdoc.fromBinaryData(file.readAll()); qDebug() << settdoc.isNull();To copy to clipboard, switch view to plain text mode
settdoc.isNull() returns true, I can read the file into a stream without any issue and I validated the json as well.
Thank you
Laszlo
Bookmarks