#ifndef TOOL_JSON_H
#define TOOL_JSON_H
#include<string>
#include<rapidjson/document.h>
#include<rapidjson/stringbuffer.h>
#include<rapidjson/prettywriter.h>
class tool_json
{
public:
static void add_member(rapidjson::Value& out_data, const char* key, std::string value,
rapidjson::Document::AllocatorType& allocator)
{
rapidjson::Value name;
name.SetString(key, allocator);
rapidjson::Value data;
data.SetString(value.c_str(), allocator);
out_data.AddMember(name, data, allocator);
}
static void push_back(rapidjson::Value& out_data, std::string value,
rapidjson::Document::AllocatorType& allocator)
{
rapidjson::Value data;
data.SetString(value.c_str(), allocator);
out_data.PushBack(data, allocator);
}
static bool try_get_iter(const char* key, const rapidjson::Value& node,
自定义json工具类 C++
最新推荐文章于 2024-07-19 14:27:26 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)