json - 串行显示后 JSONCPP 写入文件
问题描述
我希望 Json File 的缩进连续显示。
但是,Json File 创建后,缩进标记如下。
有什么办法可以串联显示平行缩进?
解决方案
我的代码是这个
Json::Value root;
Json::Value vec(Json::arrayValue);
Json::Value test1;
root["encoding"] = "UTF-8";
vec.append("python");
vec.append("c++");
vec.append("ruby");
root["indent"]["length"] = 3;
root["indent"]["use_space"] = true;
Json::StyledWriter writer;
std::string resultString=writer.write(root);
推荐阅读
- python - 将 DataFrame 的所有列与另一个 DataFrame 的行相乘
- python - 通过 dict 更新查询集没有任何效果
- xml - PowerShell 连接多个 XML 文件
- wordpress - 自定义 WP CLI 命令将数据添加到 WP REST API 自定义字段
- python-3.x - 将嵌套列表转换为字典
- git - `git push` 是否要求目标存储库已经存在?
- jenkins - ssh 踩到 Jenkinsfile
- angular - 在构造函数或 ngOnInit 中加载异步函数
- ios - 如何在不旋转地图的情况下将 GoogleMaps 居中?
- rest - 在日期范围(=时间段)内获取 Github Gists