当前位置: 首页 > news >正文

nlohmann json:通过for遍历object和array

object和array可以使用数for进行遍历:

#include <iostream>
#include <nlohmann/json.hpp>
using namespace std;
using json = nlohmann::json;auto checkJsonType(json& x)
{if(x.type() == json::value_t::null){cout<<x<<" is null"<<endl;}else if(x.type() == json::value_t::object){cout<<x<<" is object"<<endl;}else if(x.type() == json::value_t::array){cout<<x<<" is array"<<endl;}else if(x.type() == json::value_t::string){cout<<x<<" is string"<<endl;}else if(x.type() == json::value_t::boolean){cout<<x<<" is boolean"<<endl;}else if(x.type() == json::value_t::number_integer){cout<<x<<" is number_integer"<<en
http://www.lryc.cn/news/122742.html

相关文章:

  • 适配器模式:将不兼容的接口转换为可兼容的接口
  • 【量化课程】07_量化回测
  • 竞赛项目 深度学习花卉识别 - python 机器视觉 opencv
  • 用对角线去遍历矩阵
  • 【vue】点击按钮弹出卡片,点击卡片中的取消按钮取消弹出的卡片(附代码)
  • 【K8S】pod 基础概念讲解
  • ASP.NET Core中间件记录管道图和内置中间件
  • [系统安全] 五十二.DataCon竞赛 (1)2020年Coremail钓鱼邮件识别及分类详解
  • Android学习之路(3) 布局
  • Python实现GA遗传算法优化XGBoost回归模型(XGBRegressor算法)项目实战
  • C#软件外包开发流程
  • 队列的实现
  • Node + Express 后台开发 —— 起步
  • Python学习笔记第五十七天(Pandas 数据清洗)
  • Elasticsearch的一些基本概念
  • Guitar Pro8专业版吉他学习、绘谱、创作软件
  • SpringBoot复习(39)Servlet容器的自动配置原理
  • 【前端 | CSS】盒模型clientWidth、clientHeight、offsetWidht、offsetHeight
  • Django 高级指南:深入理解和使用类视图和中间件
  • 《C语言深度解剖》.pdf
  • 【小梦C嘎嘎——启航篇】string介绍以及日常使用的接口演示
  • 多个 Github 账户访问 Github
  • c#实现命令模式
  • Kubernetes的默认调度和自定义调度详解
  • 使用Spring-Security后,浏览器不能缓存的问题
  • 中睿天下入选河南省网信系统2023年度网络安全技术支撑单位
  • 代码随想录day44 45 46
  • 一探Linux下的七大进程状态
  • 香港站群服务器为什么适合seo优化?
  • 虚拟机内搭建CTFd平台搭建及CTF题库部署,局域网内机器可以访问