当前位置:网站首页>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小王子】
边栏推荐
- Data connection mode in low code platform (Part 2)
- Because the employee set the password to "123456", amd stolen 450gb data?
- A laravel background management expansion package you can't miss - Voyager
- KITTI数据集简介与使用
- Mrs offline data analysis: process OBS data through Flink job
- LeetCode 648. Word replacement
- oracle 触发器实现级联更新
- The world's first risc-v notebook computer is on pre-sale, which is designed for the meta universe!
- Selenium Library
- 内部排序——插入排序
猜你喜欢

Applet directory structure

MRS离线数据分析:通过Flink作业处理OBS数据

LeetCode 648. 单词替换

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

Base64 encoding

比尔·盖茨晒48年前简历:“没你们的好看”

Data Lake (IX): Iceberg features and data types

拼多多败诉,砍价始终差0.9%一案宣判;微信内测同一手机号可注册两个账号功能;2022年度菲尔兹奖公布|极客头条...

Codes de non - retour à zéro inversés, codes Manchester et codes Manchester différentiels couramment utilisés pour le codage des signaux numériques

CVPR2022 | 医学图像分析中基于频率注入的后门攻击
随机推荐
PLC: automatically correct the data set noise, wash the data set | ICLR 2021 spotlight
Substance Painter笔记:多显示器且多分辨率显示器时的设置
A laravel background management expansion package you can't miss - Voyager
2022云顾问技术系列之高可用专场分享会
【愚公系列】2022年7月 Go教学课程 005-变量
Emqx 5.0 release: open source Internet of things message server with single cluster supporting 100million mqtt connections
用例图
Base64 encoding
Simple steps for modifying IP of sigang electronic scale
Reverse non return to zero code, Manchester code and differential Manchester code of common digital signal coding
WPF DataGrid realizes the UI interface to respond to a data change in a single line
Introduction to sakt method
Leetcode——236. The nearest common ancestor of binary tree
oracle 非自动提交解决
PyTorch模型训练实战技巧,突破速度瓶颈
Search engine interface
杭电oj2092 整数解
leetcode:648. 单词替换【字典树板子 + 寻找若干前缀中的最短符合前缀】
《微信小程序-进阶篇》组件封装-Icon组件的实现(一)
GVIM [III] [u vimrc configuration]