diff --git a/src/utils/monero_utils.cpp b/src/utils/monero_utils.cpp index ee4c576..e586029 100644 --- a/src/utils/monero_utils.cpp +++ b/src/utils/monero_utils.cpp @@ -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& strs) { boost::property_tree::ptree strsNode; for (const auto& str : strs) { diff --git a/src/utils/monero_utils.h b/src/utils/monero_utils.h index 9eacd79..2442002 100644 --- a/src/utils/monero_utils.h +++ b/src/utils/monero_utils.h @@ -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. *