mirror of
https://github.com/wownero/wownero-cpp.git
synced 2026-10-23 01:58:49 +02:00
add monero_utils::deserialize()
This commit is contained in:
@@ -451,6 +451,13 @@ string monero_utils::serialize(const boost::property_tree::ptree& node) {
|
||||
return str.substr(0, str.size() - 1); // strip newline
|
||||
}
|
||||
|
||||
boost::property_tree::ptree monero_utils::deserialize(const string& json) {
|
||||
std::istringstream iss = json.empty() ? std::istringstream() : std::istringstream(json);
|
||||
boost::property_tree::ptree node;
|
||||
boost::property_tree::read_json(iss, node);
|
||||
return node;
|
||||
}
|
||||
|
||||
boost::property_tree::ptree monero_utils::to_property_tree(const vector<string>& strs) {
|
||||
boost::property_tree::ptree strsNode;
|
||||
for (const auto& str : strs) {
|
||||
|
||||
@@ -84,6 +84,8 @@ namespace monero_utils
|
||||
|
||||
string serialize(const boost::property_tree::ptree& node);
|
||||
|
||||
boost::property_tree::ptree deserialize(const string& json);
|
||||
|
||||
/**
|
||||
* Convert a Monero Core cryptonote::block to a block in this library's native model.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user