当前位置:网站首页>JSON解析实例(Qt含源码)
JSON解析实例(Qt含源码)
2022-07-07 12:44:00 【51CTO】
JSON解析
Qt中内置了一个QJsonDocument类用来处理json文件,以及json字符串。解析思路先将string加载到QJsonDocument中,然后将其逐层解析。json的格式包含两种,1)对象,2)数组
| 名字 | 解析 |
|---|---|
| QJsonDocument | 一个封装完整JSON文档的类,可以从UTF-8编码的基于文本的表示以及Qt自己的二进制格式读取和写入该文档 |
| QJsonObject | 是键值对的列表,其中键是唯一的字符串,值由QJsonValue表示。 |
| QJsonArray | JSON数组是一个值列表。可以通过从数组中插入和删除QJsonValue来操作该列表。 |
| QJsonValue | JSON是一种存储结构化数据的格式。它有6种基本数据类型:bool、double、string、array、object、null |
| QJsonParseError | 用于在JSON解析期间报告错误 |
对象解析
测试数据
Qt json解析对象 代码
运行结果
数组解析
测试数据
Qt json解析数组代码
运行结果
数组对象混合解析
测试数据
Qt json解析代码
运行结果
对象数组混合解析
测试数据
Qt 解析json代码
运行结果
公众号:【qt小王子】
边栏推荐
- 常用數字信號編碼之反向不歸零碼碼、曼徹斯特編碼、差分曼徹斯特編碼
- 2022 cloud consulting technology series high availability special sharing meeting
- Pytorch model trains practical skills and breaks through the bottleneck of speed
- Huawei cloud database DDS products are deeply enabled
- leetcode:648. 单词替换【字典树板子 + 寻找若干前缀中的最短符合前缀】
- Pert diagram (engineering network diagram)
- The longest ascending subsequence model acwing 1012 Sister cities
- Leetcode - Sword finger offer 05 Replace spaces
- AWS learning notes (III)
- Excuse me, does PTS have a good plan for database pressure measurement?
猜你喜欢

Webrtc audio anti weak network technology (Part 1)

全球首款 RISC-V 笔记本电脑开启预售,专为元宇宙而生!

用例图

The longest ascending subsequence model acwing 1012 Sister cities

Instructions for mictr01 tester vibrating string acquisition module development kit

EfficientNet模型的完整细节

因员工将密码设为“123456”,AMD 被盗 450Gb 数据?

Ian Goodfellow, the inventor of Gan, officially joined deepmind as research scientist

Docker deploy Oracle

2022年13个UX/UI/UE最佳创意灵感网站
随机推荐
STM32CubeMX,68套组件,遵循10条开源协议
Half an hour of hands-on practice of "live broadcast Lianmai construction", college students' resume of technical posts plus points get!
[Reading stereo matching papers] [III] ints
CVPR2022 | 医学图像分析中基于频率注入的后门攻击
JS image to Base64
Use case diagram
Small game design framework
Excuse me, does PTS have a good plan for database pressure measurement?
UML state diagram
Demis hassabis talks about alphafold's future goals
Simple use of websocket
LeetCode 648. 单词替换
Webrtc audio anti weak network technology (Part 1)
Assign a dynamic value to the background color of DataGrid through ivalueconverter
PAG体验:十分钟完成AE动效部署上线各平台!
GAN发明者Ian Goodfellow正式加入DeepMind,任Research Scientist
AWS学习笔记(三)
LeetCode每日一题(636. Exclusive Time of Functions)
Reading and understanding of eventbus source code
MLGO:Google AI发布工业级编译器优化机器学习框架