6#include <unordered_map>
41 static std::string
from(
const std::unordered_map<std::string, std::string>& map,
42 int pretty_print = 4) noexcept;
48 static std::
string from(const std::vector<std::unordered_map<std::
string, std::
string>>& arr,
49 int pretty_print = 4) noexcept;
55 static
bool from(const std::
string& s, std::unordered_map<std::
string, std::
string>& m) noexcept;
61 static
bool load(const std::
string& filename, std::unordered_map<std::
string, std::
string>& m) noexcept;
68 std::vector<std::unordered_map<std::
string, std::
string>>& vm) noexcept;
75 std::vector<std::unordered_map<std::
string, std::
string>>& vm) noexcept;
79 class json_helper_impl;
80 std::unique_ptr<json_helper_impl> impl;
JSON helper class.
Definition json_helper.h:17
json_helper()
Default constructor.
static std::string from(const std::unordered_map< std::string, std::string > &map, int pretty_print=4) noexcept
Get the contents of a map as a string in JSON format.
static bool load(const std::string &filename, std::unordered_map< std::string, std::string > &m) noexcept
Parse a JSON file into a C++ map from a file on disk.
static bool load_array(const std::string &filename, std::vector< std::unordered_map< std::string, std::string > > &vm) noexcept
Load a JSON array file into a vector of maps.
static bool from_array(const std::string &s, std::vector< std::unordered_map< std::string, std::string > > &vm) noexcept
Parse a JSON array string into a vector of maps.
~json_helper()
Destructor.