mirror of
https://github.com/OpenVPN/openvpn3.git
synced 2024-09-20 12:12:15 +02:00
jsonhelper: added format() method outputting to Buffer.
Signed-off-by: James Yonan <james@openvpn.net>
This commit is contained in:
parent
407b83e529
commit
04c3aa9b0a
@ -478,6 +478,15 @@ namespace openvpn {
|
||||
return buf_to_string(*bp);
|
||||
}
|
||||
|
||||
inline void format(const Json::Value& root, Buffer& buf)
|
||||
{
|
||||
Json::StreamWriterBuilder json_builder;
|
||||
json_builder.settings_["indentation"] = " ";
|
||||
BufferStreamOut os(buf);
|
||||
std::unique_ptr<Json::StreamWriter> sw(json_builder.newStreamWriter());
|
||||
sw->write(root, &os);
|
||||
}
|
||||
|
||||
inline std::string format(const Json::Value& root)
|
||||
{
|
||||
return root.toStyledString();
|
||||
|
Loading…
Reference in New Issue
Block a user