JSON parsing is now supported in Qt 5. Here's how to load and parse a document:
#include <QByteArray>
#include <QFile>
#include <QJsonObject>
#include <QJsonDocument>
// ...
// Read JSON file
QFile file("/path/to/file.json");
file.open(QIODevice::ReadOnly);
QByteArray rawData = file.readAll();
// Parse document
QJsonDocument doc(QJsonDocument::fromJson(rawData));
// Get JSON object
QJsonObject json = doc.object();
// Access properties
qDebug() << json["something"].toString();
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…