一、QT5 Json简介

QT4中使用第三方库QJson解析JSON文件。

QT5新增加了处理JSON的类,类均以QJson开头,包含在QtCore模块中。QT5新增加六个相关类:

QJsonArray

封装 JSON 数组

QJsonDocument

读写 JSON 文档

QJsonObject

封装 JSON 对象

QJsonObject::iterator

用于遍历QJsonObject的STL风格的非const遍历器

QJsonParseError

报告 JSON 处理过程中出现的错误

QJsonValue

封装 JSON 值

二、QJsonDocument

1、QJsonDocument简介

QJsonDocument提供了读写Json文档的方法。

QJsonDocument是一个包含了完整JSON文档的类,支持以UTF-8编码的文本和QT自身的二进制格式来读写JSON文档。

JSON文档可以使用QJsonDocument::fromJson()将基于JSON文档的文本形式转换为QJsonDocument对象,toJSON()可以将QJsonDocument转换回文本形式
    解析文档的有效性可以使用 !isNull() 进行查询。
    使用isArray()和isObject()可以分别查询一个文档是否包含了一个数组或一个object。使用array()或object()可以将包含在文档中的数组或object提取出来。
    使用fromBinaryData()或fromRawData()也可以从一个二进制形式创建一个QJsonDocument对象。

2、QJsonDocument成员函数

[static] QJsonDocument QJsonDocument::fromBinaryData(const QByteArray &data, DataValidation validation = Validate)

Validation决定数据是否在使用前检查数据有效性。

[static] QJsonDocument QJsonDocument::fromJson(const QByteArray &json, QJsonParseError *error = Q_NULLPTR)

将json解析为UTF-8的JSON文档

[static] QJsonDocument QJsonDocument::fromRawData(const char *data, int size, DataValidation validation = Validate)

使用data数据的前size字节创建一个QJsonDocument对象

[static] QJsonDocument QJsonDocument::fromVariant(const QVariant &variant)

根据variant创建QJsonDocument对象

bool QJsonDocument::isArray() const

bool QJsonDocument::isEmpty() const

bool QJsonDocument::isNull() const

bool QJsonDocument::isObject() const

QJsonObject QJsonDocument::object() const

返回文档中包含的QJsonObject对象

const char *QJsonDocument::rawData(int *size) const

返回size大小的二进制数据

void QJsonDocument::setArray(const QJsonArray &array)

设置array作为文档中的主对象

void QJsonDocument::setObject(const QJsonObject &object)

设置object作为文档中的主对象

QByteArray QJsonDocument::toBinaryData() const

返回文档的二进制格式数据

QByteArray QJsonDocument::toJson(JsonFormat format = Indented) const

将QJsonDocument转换为UTF-8编码的format格式的JSON文档

QVariant QJsonDocument::toVariant() const

返回JSON文档的QVariant格式

3、QJsonDocument对象的构建

A、QJsonDocument fromJson(const QByteArray &json, QJsonParseError *error = Q_NULLPTR)

fromJson()可以由QByteArray对象构造一个QJsonDocument对象

QJsonObject json;
json.insert("name", QString("Qt"));
json.insert("version", );
json.insert("windows", true);
QJsonDocument document;
document.setObject(json);
QByteArray byte_array = document.toJson(QJsonDocument::Compact);
QJsonParseError json_error;
QJsonDocument parse_doucment = QJsonDocument::fromJson(byte_array, &json_error);

B、QJsonDocument fromVariant(const QVariant &variant)

QVariantList people;
QVariantMap bob;
bob.insert("Name", "Bob");
bob.insert("Phonenumber", );
QVariantMap alice;
alice.insert("Name", "Alice");
alice.insert("Phonenumber", );
people << bob << alice;
QJsonDocument jsonDocument = QJsonDocument::fromVariant(people);
if (!jsonDocument.isNull())
{
qDebug() << jsonDocument.toJson();
}

C、QJsonDocument fromRawData(const char *data, int size, DataValidation validation = Validate)

D、QJsonDocument fromBinaryData(const QByteArray &data, DataValidation validation = Validate)

三、QJsonArray

1、QJsonArray简介

QJsonArray封装了JSON数组。

JSON数组是值的链表,可以插入和删除QJsonValue。

QJsonArray与QVariantList可以相互转换。QJsonArray可以用size(), insert(), removeAt()进行操作,还可以用标准C++的迭代器模式来迭代其内容。
    QJsonArray是一个隐式共享的类,只要没有被改变,可以和创建QJsonArray的document共享数据。
    通过QJsonDocument可以将一个QJsonArray转换成或转换自一个文本形式的JSON。

2、QJsonArray成员函数

QJsonArray::QJsonArray(std::initializer_list<QJsonValue> args)

构建一个QJsonArray

QJsonArray::QJsonArray(const QJsonArray &other)

void QJsonArray::append(const QJsonValue &value)

在QJsonArray尾部插入value

QJsonValue QJsonArray::at(int i) const

返回QJsonArray中索引为i的QJsonValue值

iterator QJsonArray::begin()

const_iterator QJsonArray::begin() const

返回指向数组第一个元素的STL风格迭代器

const_iterator QJsonArray::constBegin() const

返回指向数组第一个元素的const STL风格迭代器

const_iterator QJsonArray::constEnd() const

返回指向数组最后一个元素后的位置的const STL风格迭代器

bool QJsonArray::contains(const QJsonValue &value) const

如果数组中包含value,返回true

int QJsonArray::count() const

返回数组的大小

bool QJsonArray::empty() const

如果数组为空,返回true

const_iterator QJsonArray::end() const

返回指向数组最后一个元素后的位置的STL风格迭代器

iterator QJsonArray::erase(iterator it)

删除迭代器it指向的元素,返回指向下一个元素的迭代器

QJsonValue QJsonArray::first() const

返回数组中的第一个值

[static] QJsonArray QJsonArray::fromStringList(const QStringList &list)

将一个字符串链表list转换为QJsonArray

[static] QJsonArray QJsonArray::fromVariantList(const QVariantList &list)

将链表list转换为QJsonArray

四、QJsonObject

1、QJsonObject简介

QJsonObject类用于封装JSON对象。JSON对象是包含键值对的链表,其中键是唯一的字符串,其值由QJsonValue代表。

QJsonObject可以与QVariantMap相互转换,可以用size()来获得键值对的数目,insert()、remove()分别用来插入和删除pair。可以用标准C++的迭代器模式(iterator pattern)来迭代其内容。
    QJsonObject是一个隐式共享的类,只要没有被改变过,QJsonObject会和创建它的document共享数据。
    可以通过QJsonDocument将QJsonObject和文本格式相互转换。

2、QJsonObject成员函数

QJsonObject::QJsonObject(std::initializer_list<QPair<QString, QJsonValue> > args)

使用键值对链表构建QJsonObject对象

QJsonObject::QJsonObject(const QJsonObject &other)

iterator QJsonObject::begin()

const_iterator QJsonObject::begin() const

返回指向JSON对象的第一个元素的STL风格的迭代器

const_iterator QJsonObject::constBegin() const

返回指向JSON对象的第一个元素的const STL风格的迭代器

const_iterator QJsonObject::constEnd() const

返回SJON对象的最后一个元素后的位置的const STL风格的迭代器

const_iterator QJsonObject::constFind(const QString &key) const

返回一个指向键值对中键为key的元素的const迭代器

bool QJsonObject::contains(const QString &key) const

如果JSON对象中包含键key,返回true

int QJsonObject::size() const

int QJsonObject::count() const

返回JSON对象中键值对的数量

bool QJsonObject::empty() const

bool QJsonObject::isEmpty() const

如果JSON对象为空,返回true

iterator QJsonObject::find(const QString &key)

const_iterator QJsonObject::find(const QString &key) const

返回指向JSON对象中键为key的键值对的迭代器

[static] QJsonObject QJsonObject::fromVariantHash(const QVariantHash &hash)

将hash转换为JSON对象

[static] QJsonObject QJsonObject::fromVariantMap(const QVariantMap &map)

将map转换为JSON对象

iterator QJsonObject::insert(const QString &key, const QJsonValue &value)

插入键为key,值为value的键值对,返回插入键值对的迭代器

QStringList QJsonObject::keys() const

返回JSON对象的所有键的链表

void QJsonObject::remove(const QString &key)

删除JSON对象中的key

QJsonValue QJsonObject::take(const QString &key)

删除JSON对象中的键key,返回key对应的QJsonValue

QVariantHash QJsonObject::toVariantHash() const

将JSON对象转换为QVariantHash

QVariantMap QJsonObject::toVariantMap() const

将JSON对象转换为QVariantMap

QJsonValue QJsonObject::value(const QString &key) const

返回key对应的QJsonValue值

五、QJsonParseError

1、QJsonParseError简介

QJsonParseError类用于在JSON解析中报告错误。

常量

 

描述

QJsonParseError::NoError

0

未发生错误

QJsonParseError::UnterminatedObject

1

对象不正确地终止以右花括号结束

QJsonParseError::MissingNameSeparator

2

分隔不同项的逗号丢失

QJsonParseError::UnterminatedArray

3

数组不正确地终止以右中括号结束

QJsonParseError::MissingValueSeparator

4

对象中分割 key/value 的冒号丢失

QJsonParseError::IllegalValue

5

值是非法的

QJsonParseError::TerminationByNumber

6

在解析数字时,输入流结束

QJsonParseError::IllegalNumber

7

数字格式不正确

QJsonParseError::IllegalEscapeSequence

8

在输入时,发生一个非法转义序列

QJsonParseError::IllegalUTF8String

9

在输入时,发生一个非法 UTF8 序列

QJsonParseError::UnterminatedString

10

字符串不是以引号结束

QJsonParseError::MissingObject

11

一个对象是预期的,但是不能被发现

QJsonParseError::DeepNesting

12

对解析器来说,JSON 文档嵌套太深

QJsonParseError::DocumentTooLarge

13

对解析器来说,JSON 文档太大

QJsonParseError::GarbageAtEnd

14

解析的文档在末尾处包含额外的乱码

2、QJsonParseError成员函数

QString QJsonParseError::errorString() const

返回JSON解析错误时报告的错误信息

五、QJsonValue

1、QJsonValue简介

QJsonValue类封装了JSON中的值。JSON中的值有6种基本类型:

bool           QJsonValue::Bool

double         QJsonValue::Double

string         QJsonValue::String

array          QJsonValue::Array

object         QJsonValue::Object

null           QJsonValue::Null

Undefined      QJsonValue::Undefined

value可以是以上任何一种数据类型。另外,QJsonValue有一个特殊的flag来表示未定义类型。可以用isUndefined()来查询。 
    可以用type()或isBool(),、isString()等来查询value的类型。类似的,可以用toBool()、toString()等将一个value转换成存储在该value内部的类型。

2、QJsonValue成员函数

[static] QJsonValue QJsonValue::fromVariant(const QVariant &variant)

将variant转换为QJsonValue

bool QJsonValue::isArray() const

如果QJsonValue包含一个数组,返回true

bool QJsonValue::isBool() const

如果QJsonValue包含一个bool,返回true

bool QJsonValue::isDouble() const

如果QJsonValue包含一个double,返回true

bool QJsonValue::isNull() const

如果QJsonValue包含一个Null,返回true

bool QJsonValue::isObject() const

如果QJsonValue包含一个object,返回true

bool QJsonValue::isString() const

如果QJsonValue包含一个string,返回true

bool QJsonValue::isUndefined() const

如果QJsonValue包含一个undefined,返回true

QJsonArray QJsonValue::toArray(const QJsonArray &defaultValue) const

将QJsonValue转换为QJsonArray并返回,如果类型不是array,返回默认值defaultValue

QJsonArray QJsonValue::toArray() const

将QJsonValue转换为QJsonArray并返回

bool QJsonValue::toBool(bool defaultValue = false) const

将QJsonValue转换为bool并返回

double QJsonValue::toDouble(double defaultValue = 0) const

将QJsonValue转换为double并返回

int QJsonValue::toInt(int defaultValue = 0) const

将QJsonValue转换为int并返回

QJsonObject QJsonValue::toObject(const QJsonObject &defaultValue) const

QJsonObject QJsonValue::toObject() const

将QJsonValue转换为QJsonObject并返回

QString QJsonValue::toString(const QString &defaultValue = QString()) const

将QJsonValue转换为QString并返回

Type QJsonValue::type() const

返回QJsonValue的类型

六、JSON解析编程

1、JSON解析流程

JSON解析的流程如下:

A、将对应的字符串生成QJsonDocument对象

B、判断QJsonDocument对象是QJsonObject还是QJsonArray

C、如果是QJsonObject类型,获取一个QJsonObject对象,然后根据QJsonObject的API函数进行解析

D、如果是QJsonArray类型,获取一个QJsonArray对象,然后根据QJsonArray的API函数进行解析

E、根据获取的QJsonObject或QJsonArray取得QJsonValue类型的数据

F、迭代分解数据获取各个值

JSON解析流程实例:

#include <QCoreApplication>
#include <QJsonDocument>
#include <QJsonArray>
#include <QJsonObject>
#include <QJsonParseError>
#include <QJsonValue>
#include <QString>
#include <QStringList>
#include <QDebug> int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv); QString json("{\"name\":\"scorpio\", \"year\":2016, \"array\":[30, \"hello\", true]}");
QJsonParseError jsonerror;
QJsonDocument doc = QJsonDocument::fromJson(json.toLatin1(), &jsonerror);
if (!doc.isNull() && jsonerror.error == QJsonParseError::NoError)
{
if(doc.isObject())
{
QJsonObject object = doc.object();
QStringList list = object.keys();
for(int i = ; i < list.count(); i++)
{
qDebug() << list.at(i);
}
QJsonObject::iterator it = object.begin();
while(it != object.end())
{
switch(it.value().type())
{
case QJsonValue::String:
{
qDebug() << "Type is string";
QJsonArray sub = it.value().toArray();
qDebug() << it.key() << "=" << it.value().toString();
break;
}
case QJsonValue::Array:
{
qDebug() << "Type is Array";
qDebug() << it.key() << "=" << it.value().toArray();
QJsonArray sub = it.value().toArray();
qDebug() << "index 1:" << sub.at().toDouble();
qDebug() << "index 2:" << sub.at().toString();
qDebug() << "index 3:" << sub.at().toBool();
break;
}
case QJsonValue::Bool:
{
qDebug() << "Type is Bool";
qDebug() << it.key() << "=" << it.value().toBool();
break;
}
case QJsonValue::Double:
{
qDebug() << "Type is Double";
qDebug() << it.key() << "=" << it.value().toDouble();
break;
}
case QJsonValue::Object:
{
qDebug() << "Type is Object";
qDebug() << it.key() << "=" << it.value().toObject();
break;
}
case QJsonValue::Null:
{
qDebug() << "Type is Null";
qDebug() << it.key() << "= NULL" ;
break;
}
case QJsonValue::Undefined:
{
qDebug() << "Type is Undefined";
break;
}
}
it++;
}
}
} return a.exec();
}
 

2、QJsonObject

JSON对象:

{

"Cross Platform": true,

"From": 2016,

"Name": "Qt"

}

A、构建JSON对象

// 构建 JSON 对象

QJsonObject json;

json.insert("Name", "Qt");

json.insert("From", 2016);

json.insert("Cross Platform", true);

B、构建JSON文档

// 构建 JSON 文档

QJsonDocument document;

document.setObject(json);

QByteArray byteArray = document.toJson();

QString strJson(byteArray);

C、解析JSON

 QJsonParseError jsonError;
QJsonDocument doucment = QJsonDocument::fromJson(byteArray, &jsonError);
if (!doucment.isNull() && (jsonError.error == QJsonParseError::NoError))
{
if (doucment.isObject())
{
QJsonObject object = doucment.object();
if (object.contains("Name"))
{ // 包含指定的 key
QJsonValue value = object.value("Name");
if (value.isString())
{ // 判断 value 是否为字符串
QString strName = value.toString();
qDebug() << "Name : " << strName;
}
}
if (object.contains("From"))
{
QJsonValue value = object.value("From");
if (value.isDouble())
{
int nFrom = value.toVariant().toInt();
qDebug() << "From : " << nFrom;
}
}
if (object.contains("Cross Platform"))
{
QJsonValue value = object.value("Cross Platform");
if (value.isBool())
{
bool bCrossPlatform = value.toBool();
qDebug() << "CrossPlatform : " << bCrossPlatform;
}
}
}
}
 

3、QJsonArray

JSON数组:

[

"Qt",

5.7,

true

]

A、构建JSON数组

// 构建 JSON 数组

QJsonArray json;

json.append("Qt");

json.append(5.7);

json.append(true);

B、构建JSON文档

// 构建 JSON 文档

QJsonDocument document;

document.setArray(json);

QByteArray byteArray = document.toJson(QJsonDocument::Compact);

QString strJson(byteArray);

C、解析JSON

 QJsonParseError jsonError;
QJsonDocument doucment = QJsonDocument::fromJson(byteArray, &jsonError);
if (!doucment.isNull() && (jsonError.error == QJsonParseError::NoError))
{
if (doucment.isArray())
{
QJsonArray array = doucment.array();
int nSize = array.size();
for (int i = ; i < nSize; ++i)
{ // 遍历数组
QJsonValue value = array.at(i);
if (value.type() == QJsonValue::String)
{
QString strName = value.toString();
qDebug() << strName;
}
if (value.type() == QJsonValue::Double)
{
double dVersion = value.toDouble();
qDebug() << dVersion;
}
if (value.type() == QJsonValue::Bool)
{
bool bCrossPlatform = value.toBool();
qDebug() << bCrossPlatform;
}
}
}
}
 

4、复杂JSON

{

    "Company": "Digia",

    "From": ,

    "Name": "Qt",

    "Page": {

        "Developers": "https://www.qt.io/developers/",

        "Download": "https://www.qt.io/download/",

        "Home": "https://www.qt.io/"},

    "Version": [

        4.8,

        5.2,

        5.7]

}

   // 构建 Json 数组 - Version
QJsonArray versionArray;
versionArray.append(4.8);
versionArray.append(5.2);
versionArray.append(5.7); // 构建 Json 对象 - Page
QJsonObject pageObject;
pageObject.insert("Home", "https://www.qt.io/");
pageObject.insert("Download", "https://www.qt.io/download/");
pageObject.insert("Developers", "https://www.qt.io/developers/"); // 构建 Json 对象
QJsonObject json;
json.insert("Name", "Qt");
json.insert("Company", "Digia");
json.insert("From", );
json.insert("Version", QJsonValue(versionArray));
json.insert("Page", QJsonValue(pageObject)); // 构建 Json 文档
QJsonDocument document;
document.setObject(json);
QByteArray byteArray = document.toJson(QJsonDocument::Compact);
QString strJson(byteArray);
//解析JSON
QJsonParseError jsonError;
QJsonDocument doucment = QJsonDocument::fromJson(byteArray, &jsonError);
if (!doucment.isNull() && (jsonError.error == QJsonParseError::NoError))
{
if (doucment.isObject())
{
QJsonObject object = doucment.object();
if (object.contains("Name"))
{
QJsonValue value = object.value("Name");
if (value.isString())
{
QString strName = value.toString();
qDebug() << "Name : " << strName;
}
}
if (object.contains("Company"))
{
QJsonValue value = object.value("Company");
if (value.isString())
{
QString strCompany = value.toString();
qDebug() << "Company : " << strCompany;
}
}
if (object.contains("From"))
{
QJsonValue value = object.value("From");
if (value.isDouble())
{
int nFrom = value.toVariant().toInt();
qDebug() << "From : " << nFrom;
}
}
if (object.contains("Version"))
{
QJsonValue value = object.value("Version");
if (value.isArray())
{
QJsonArray array = value.toArray();
int nSize = array.size();
for (int i = ; i < nSize; ++i)
{
QJsonValue value = array.at(i);
if (value.isDouble())
{
double dVersion = value.toDouble();
qDebug() << "Version : " << dVersion;
}
}
}
}
if (object.contains("Page"))
{
QJsonValue value = object.value("Page");
if (value.isObject())
{
QJsonObject obj = value.toObject();
if (obj.contains("Home"))
{
QJsonValue value = obj.value("Home");
if (value.isString())
{
QString strHome = value.toString();
qDebug() << "Home : " << strHome;
}
}
if (obj.contains("Download"))
{
QJsonValue value = obj.value("Download");
if (value.isString())
{
QString strDownload = value.toString();
qDebug() << "Download : " << strDownload;
}
}
if (obj.contains("Developers"))
{
QJsonValue value = obj.value("Developers");
if (value.isString())
{
QString strDevelopers = value.toString();
qDebug() << "Developers : " << strDevelopers;
}
}
}
}
}
}
#include <QCoreApplication>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QDebug>
#include <QString>
#include <QJsonParseError> int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv); QJsonArray jsonArray;
jsonArray.insert(,"linux");
jsonArray.insert(,"python");
jsonArray.insert(,"java"); QJsonObject json;
json.insert("name",QString("QT"));
json.insert("version",);
json.insert("windows",true);
json.insert("language",jsonArray); QJsonDocument document;
document.setObject(json);
QByteArray bytearray = document.toJson(QJsonDocument::Compact); QString jsonStr(bytearray);
qDebug() << bytearray;
qDebug() << jsonStr; QJsonParseError jsonError;
QJsonDocument paserDoc = QJsonDocument::fromJson(bytearray,&jsonError);
if (jsonError.error == QJsonParseError::NoError) {
QJsonObject paserObj = paserDoc.object();
if (paserObj.contains("name")) {
QJsonValue nameValue = paserObj.take("name");
if (nameValue.isString()) {
qDebug() << "name: " << nameValue.toString();
}
}
if (paserObj.contains("version")) {
QJsonValue version = paserObj["version"];
if (version.isDouble())
qDebug() << "version: " << version.toInt();
}
if (paserObj.contains("language")) {
QJsonValue langValue = paserObj.take("language");
if (langValue.isArray()) {
QJsonArray array = langValue.toArray();
for(int i = ; i < array.size(); ++i) {
QJsonValue tmp = array.at(i);
if (tmp.isString())
qDebug() << tmp.toString();
}
}
}
} return a.exec();
}
"{\"language\":[\"linux\",\"python\",\"java\"],\"name\":\"QT\",\"version\":5,\"w
indows\":true}"
"{\"language\":[\"linux\",\"python\",\"java\"],\"name\":\"QT\",\"version\":5,\"w
indows\":true}"
name: "QT"
version:
"linux"
"python"
"java"

原文:https://blog.51cto.com/9291927/1884442

Qt--解析Json的更多相关文章

  1. Qt解析Json数据

    1 JSON数据简介   JSON(JavaScript Object Notation, JS 对象简谱) 是一种轻量级的数据交换格式.它基于 ECMAScript (欧洲计算机协会制定的js规范) ...

  2. QT使用QJson生成解析Json数据的方法

    QT中使用json还是比较方便的,下面用例子直接说明 举例子之前首先推荐一个在线解析json格式的网站,具体格式用法如下图所示: 之后根据这个格式进行json数据解析. QT使用json需要包含的头文 ...

  3. Qt之JSON生成与解析

    JSON(JavaScript Object Notation)是一种轻量级的数据交换格式.它基于JavaScript(Standard ECMA-262 3rd Edition - December ...

  4. 【转载】Qt之JSON生成与解析

    JSON(JavaScript Object Notation)是一种轻量级的数据交换格式.它基于JavaScript(Standard ECMA-262 3rd Edition - December ...

  5. QT解析嵌套JSON表达式

    QT5开发环境集成了解析JSON表达式的库.使用很方便. 友情提示一下,好像在QT4环境里.须要到官网下载相关的库文件才干使用解析功能.话不多说,上代码 1.在pro文件里增加 QT += scrip ...

  6. Qt QJson解析json数据

    Qt QJson解析json数据 //加载根目录文件 void TeslaManageData::loadRootFolderFiles() { QNetworkAccessManager *mana ...

  7. 更好更快更高效解析JSON说明

    现在来一个实例解析类,直接就把解析JSON到QVariant去了.唯一不足的是没有搞错误处理,具体方法也请各位自行参考json-c的发行文档,这样比较方便叙述,STL或者Boost我都没有认真接触过, ...

  8. 使用QtScript库解析Json数组例子

    本文转载自:http://blog.sina.com.cn/s/blog_671732440100uwxh.html 使用qtscipt库解析json数组首先在工程文件中加 QT        += ...

  9. QJsonDocument实现Qt下JSON文档读写

    版权声明:若无来源注明,Techie亮博客文章均为原创. 转载请以链接形式标明本文标题和地址: 本文标题:QJsonDocument实现Qt下JSON文档读写     本文地址:http://tech ...

  10. Qt读写Json

    Qt操作Json 1.QJsonDocument 1.详细说明 QJsonDocument类提供了读写JSON文档的方法. QJsonDocument是一个封装了完整JSON文档的类,可以从基于UTF ...

随机推荐

  1. 1010 Radix:猥琐的测试数据

    谨以此题纪念边界测试数据浪费了我多少时间:https://pintia.cn/problem-sets/994805342720868352/problems/994805507225665536 # ...

  2. Go语言学习笔记(9)——接口类型

    接口 Go 语言提供了另外一种数据类型即接口,它把所有的具有共性的方法定义在一起,任何其他类型只要实现了这些方法就是实现了这个接口. /* 定义接口 */ type interface_name in ...

  3. 整合MyBatis

    配置数据源相关属性(见前一章节 DataSource配置) 引入依赖 <dependency> <groupId>org.mybatis.spring.boot</gro ...

  4. 3.asp.net core 关键概念

    1. StartUp类 在Startup.ConfigureServices方法里配置或注册服务 在Startup.Configure方法里配置请求处理管道.请求处理管道由一系列中间件组建构成,每个中 ...

  5. IErrorHandler

    /// <summary> /// WCF服务端异常处理器 /// </summary> public class WCF_ExceptionHandler : IErrorH ...

  6. Java Web-Redis学习

    Java Web-Redis学习 基本概念 Redis是一款高性能的NOSQL系列的.非关系型数据库 NOSQL:not only SQL,是一系列非关系型数据库的总称,例如radis.hbase等数 ...

  7. ElementUI对话框(dialog)提取为子组件

    需求:在页面的代码太多,想把弹窗代码提取为子组件,复用也方便.   这里涉及到弹窗el-dialog的一个属性show-close: show-close="false"是设置不显 ...

  8. 浅谈javascript中变量作用域和内存(1)

    先理解两个概念:基本类型和引用类型的值 1.基本类型和引用类型的值 (1)定义: 基本类型:指简单的数据段,比如按值访问的js五种基本数据类型undefined.null.boolean.number ...

  9. 二、详解mysql数据类型

    一.主要内容 1.介绍mysql中常用的数据类型 2.mysql类型和java类型对应关系 3.数据类型选择的一些建议 二.mysql的数据类型 主要包括以下五大类 整数类型:bit  bool  t ...

  10. 浅谈sqoop

    1.sqoop的概述a.sqoop 是一款工具,是appche 旗下的一款工具,主要是负责 hadoop与RDBMS之间的数据迁移,即从hadoop 文件系统 导出数据到RDBMS,从RDBMS导入数 ...