【QT】JSON对象转换为string
QJsonObject resultJsonData;
resultJsonData["detect_objects"] = detectObjects;
// 将 QJsonObject 转换为字符串
QJsonDocument doc(resultJsonData);
QString resultJsonString = QString::fromUtf8(doc.toJson(QJsonDocument::Compact));
// 赋值给结果 JSON 对象
jsonObj["resultJson"] = resultJsonString;

浙公网安备 33010602011771号