QJsonObject obj; obj["name"] = "John"; obj["age"] = 30; QJsonValue value(obj);
QString jsonString = "{\"name\": \"John\", \"age\": 30}"; QJsonDocument jsonDoc = QJsonDocument::fromJson(jsonString.toUtf8()); QJsonValue value = jsonDoc.object()["name"];
QJsonValue value("hello"); QString strValue = value.toString();In this example, a QJsonValue representing a string is converted to a QString using the toString() method. Overall, QJsonValue is a part of the Qt Core library.