add monero_utils::deserialize()

This commit is contained in:
woodser
2019-10-09 10:51:04 -04:00
parent af4d09f1c6
commit 480f1e45cc
2 changed files with 9 additions and 0 deletions
+7
View File
@@ -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) {
+2
View File
@@ -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.
*