Qt浅译:JSON Support in Qt

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中的值


<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"16"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
阅读(6) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
评论热议
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值