QJsonObject

 QByteArray nameMd5Array= QCryptographicHash::hash(QByteArray("jdliu"),QCryptographicHash::Md5);
    QJsonObject qobj1;
    qobj1.insert("name",QString("jdliu"));
    qobj1.insert("age",12);
    QJsonDocument jsonDocument(qobj1);
    QByteArray abyteArray=jsonDocument.toJson();
    qDebug()<<abyteArray<<endl;;
    QByteArray abyteArray2=jsonDocument.toJson(QJsonDocument::Indented);
    qDebug()<<abyteArray2<<endl;;
    qDebug()<<QString(nameMd5Array.toHex())<<endl;
    qDebug()<<"########"<<endl;
    QJsonDocument jsonDocument2=QJsonDocument::fromJson(abyteArray);
    QJsonObject json2= jsonDocument2.object();
    QJsonValue jvalue1= json2.value("name");
    qDebug()<<jvalue1.toString()<<endl;
posted @ 2025-05-25 16:34  jdliu1192839779  阅读(27)  评论(0)    收藏  举报