首页 > 解决方案 > 串行显示后 JSONCPP 写入文件

问题描述

我希望 Json File 的缩进连续显示。

在此处输入图像描述

但是,Json File 创建后,缩进标记如下。

在此处输入图像描述

有什么办法可以串联显示平行缩进?

标签: json

解决方案


我的代码是这个

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);

推荐阅读