//{"sandbox":"DefaultBox","ProcessInject":[{"NameList":["r1.exe","r2.exe"],"Inject":"white"}],"cmd":"ProcessInject"} QJsonArray processes; processes.append("r1.exe"); processes.append("r1.exe"); processes.append("r2.exe"); processes.append("r2.exe"); processes.append("r3.exe"); processes.append("r3.exe"); QJsonObject objListInject; objListInject.insert("NameList", processes); objListInject.insert("Inject", "white"); QJsonArray arrProcessArr; arrProcessArr.append(objListInject); QJsonObject root_Obj; root_Obj.insert("sandbox", "DefaultBox"); root_Obj.insert("ProcessInject", arrProcessArr); root_Obj.insert("cmd", "ProcessInject"); //创建Json文档 QJsonDocument rootDoc; rootDoc.setObject(root_Obj); QByteArray root_str = rootDoc.toJson(QJsonDocument::Compact); //紧凑格式 QString strJson(root_str); qDebug() << strJson; g_pWebsocket->WebSocketMessageReceived(strJson);