JSON Support in Qt

 
Qt5之后开始提供对处理JSON数据的支持,JSON是一种Interter数据交换的数据格式。
 
JSON 用于存储结构化的数据,JSON有6种基本数据类型:
 
bool double string array object null
 
 
All keys in an object are strings, and an object cannot contain any duplicate keys. 
在JSON的对象中,所有的键都是字符串,且不能包含重复的字符串。
 
Entries in arrays and objects are separated by commas. The separator between keys and values in an object is a colon (:).
在JSON中,键和值用":"隔开,多个键值对之间用","隔开。
 
A valid JSON document is either an array or an object, so a document always starts with a square or curly bracket.
有效的JSON文本是一个数组或对象,因此JSON文本总是以方括号或大括号开始。
 
举例:
 
{
    "FirstName": "John",
    "LastName": "Doe",
    "Age": 43,
    "Address": {
        "Street": "Downing Street 10",
        "City": "London",
        "Country": "Great Britain"
    },
    "Phone numbers": [
        "+44 1234567",
        "+44 2345678"
    ]
}
 
 
 
Qt中的JSON相关类
 
QJsonArray Encapsulates a JSON array 封装JSON数组
QJsonDocument Way to read and write JSON documents 读取和写入JSON文本的方式
QJsonObject Encapsulates a JSON object 封装JSON对象
QJsonObject::iterator QJsonObject::iterator class provides an STL-style non-const iterator for QJsonObject JSON迭代器
QJsonObject::const_iterator QJsonObject::const_iterator class provides an STL-style const iterator for QJsonObject JSON const迭代器
QJsonParseError Used to report errors during JSON parsing 用于报告JSON解析期间的错误
QJsonValue Encapsulates a value in JSON 封装JSON中的值

http://blog.csdn.net/jan5_reyn/article/details/38955721

Qt浅译:JSON Support in Qt(JSON只有六种数据类型)的更多相关文章

  1. Jersey(1.19.1) - JSON Support

    Jersey JSON support comes as a set of JAX-RS MessageBodyReader<T> and MessageBodyWriter<T&g ...

  2. Qt浅谈内存泄露(总结)

    Qt浅谈内存泄露(总结) 来源 http://blog.csdn.net/taiyang1987912/article/details/29271549 一.简介 Qt内存管理机制:Qt 在内部能够维 ...

  3. Qt浅谈之总结(整理)

    Qt浅谈之总结(整理) 来源 http://blog.csdn.net/taiyang1987912/article/details/32713781 一.简介 QT的一些知识点总结,方便以后查阅. ...

  4. Qt翻译---Thread Support in Qt

    Thread Support in Qt QT提供线程支持在平台独立的线程类.一个安全线程的传递事件的方式,一个信号槽的链接在线程之中.这使得开发多线程容易.多线程程序也是一个有用的范例为不冻结用户界 ...

  5. JSON Support in PostgreSQL and Entity Framework

    JSON 和JSONB的区别(What's difference between JSON and JSONB data type in PosgresSQL?) When should be use ...

  6. Qt::浅谈信号槽连接,参数在多线程中的使用

    Qt的信号槽有五种连接方式定义在enum Qt::ConnectionType,下面简单介绍 Qt::AutoConnection:自动判断连接方式,如果信号发送对象和执行槽对象在同一线程,那么等于Q ...

  7. Qt浅谈之二十六图片滑动效果

    一.简介 博客中发现有作者写的仿360的代码,觉得其中图片滑动的效果很有意思,特提取其中的代码.并加上类似mac的画面移动的动画效果. 二.详解 1.代码一:界面滑动(QWidget) (1)slid ...

  8. QT入门学习笔记2:QT例程

    转至:http://blog.51cto.com/9291927/2138876 Qt开发学习教程 一.Qt开发基础学习教程 本部分博客主要根据狄泰学院唐老师的<QT实验分析教程>创作,同 ...

  9. Java:JSON解析工具-org.json

    一.简介 org.json是Java常用的Json解析工具,主要提供JSONObject和JSONArray类,现在就各个类的使用解释如下. 二.准备 1.在使用org.json之前,我们应该先从该网 ...

随机推荐

  1. Leetcode OJ 刷题

    Valid Palindrome吐槽一下Leetcode上各种不定义标准的输入输出(只是面试时起码能够问一下输入输出格式...),此篇文章不是详细的题解,是自己刷LeetCode的一个笔记吧,尽管没有 ...

  2. SQL Server数据转换【包括Geometry类型】的技巧总结

    1. 字段的组合: update new_master_location set tmp_street_unique=street+'_'+city+'_'+state+'_'+zip+'_'+con ...

  3. DataSet - DataTable - DataRow 读取 xml 文件 + 搜索

    DataSet ds = XmlHelper.GetDataSetByXml(AppDomain.CurrentDomain.BaseDirectory + "/Config/ConfigN ...

  4. 与html相关的知识点整理

    梳理html时发现的一些问题.总结一下,答案大都从网上找来. 一.html 与 htm 的区别 没有本质的区别..htm是在win32时代,系统只能识别3位扩展名时使用的.现在一般都使用.html. ...

  5. hdu 2519 新生晚会 排列组合

    通过阶段性计算减少一次性的大值计算 #include <stdio.h> int main() { int t, a, b, i; __int64 c; scanf("%d&qu ...

  6. zoj 1962 How Many Fibs?(字符串化为数字处理)

    事实证明还是,题目拿到手之后,还是还是好好动手划一下比较好,不然直接想打哪!打到哪!很容易乱掉的.将数字倒着弄成字符串比较好处理. #include<stdio.h> #include&l ...

  7. 在CG/HLSL中访问着色器属性(Properties)

    在CG/HLSL中访问着色器属性 Shader在Properties块中访问材质属性.如果你想在一个着色程序中访问一些属性,你需要声明一个Cg/HLSL具有相同的名称和一个匹配的类型的变量. Prop ...

  8. Tomcat启动报Error listenerStart错误

    http://xpenxpen.iteye.com/blog/1545648 今天启动Tomcat启动不了,报以下错: org.apache.catalina.core.StandardContext ...

  9. final, finally, finalize 的区别

    1.final 用于声明属性, 方法和类, 分别表示属性不可变, 方法不可覆盖, 类不可继承.内部类要访问局部变量, 局部变量必须定义成 final 类型, 例如, 一段代码…… 2.finally ...

  10. Dos关闭进程命令

    netstat -ao 查找占用端口的进程 taskkikk /pid 端口pid  /f