Qt浅译:JSON Support in Qt(JSON只有六种数据类型)

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

posted @   findumars  Views(2052)  Comments(0Edit  收藏  举报
编辑推荐:
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
阅读排行:
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
点击右上角即可分享
微信分享提示