QJsonParseError json_error;
QByteArray buffer = “…………”;
QJsonDocument parse_doc = QJsonDocument::fromJson(buffer, &json_error);
if(json_error.error == QJsonParseError::NoError)
{
if(parse_doc.isObject())
{
QJsonObject obj = parse_doc.object();
if(obj.contains("access_token"))
{
QJsonValue jv = obj.take("access_token");
if(jv.isString())
{
m_access_token = jv.toString();
}
}
if(obj.contains("ticket"))
{
QJsonValue jv = obj.take("ticket");
if(jv.isString())
{
m_ticket = jv.toString();
}
}
}
}
014 QJson解析、封装?
最新推荐文章于 2023-06-17 11:13:48 发布