aboutsummaryrefslogtreecommitdiff
path: root/src/util/serialize.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/serialize.h')
-rw-r--r--src/util/serialize.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/util/serialize.h b/src/util/serialize.h
index 36324a675..e22434191 100644
--- a/src/util/serialize.h
+++ b/src/util/serialize.h
@@ -405,6 +405,13 @@ std::string serializeJsonString(const std::string &plain);
// Reads a string encoded in JSON format
std::string deSerializeJsonString(std::istream &is);
+// If the string contains spaces, quotes or control characters, encodes as JSON.
+// Else returns the string unmodified.
+std::string serializeJsonStringIfNeeded(const std::string &s);
+
+// Parses a string serialized by serializeJsonStringIfNeeded.
+std::string deSerializeJsonStringIfNeeded(std::istream &is);
+
// Creates a string consisting of the hexadecimal representation of `data`
std::string serializeHexString(const std::string &data, bool insert_spaces=false);