summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Scheibner <flo.de@hotmail.de>2015-11-12 14:28:53 +0100
committerFlorian Scheibner <flo.de@hotmail.de>2015-11-12 14:28:53 +0100
commite96015a3043f7da0359dc8887b543803041ceef9 (patch)
tree42137dfb38a4dde7a2de9d49a331ce0c30219d38
parent61cd5d3c264fd497af4df4e114d67dc7ead16a58 (diff)
Output boolean values correctly as json
previously 1 was printed instead of true fixes showing custom keyboards
-rw-r--r--include/tgbot/TgTypeParser.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/tgbot/TgTypeParser.h b/include/tgbot/TgTypeParser.h
index f7c9791..07eb1b6 100644
--- a/include/tgbot/TgTypeParser.h
+++ b/include/tgbot/TgTypeParser.h
@@ -187,6 +187,17 @@ private:
json += ',';
}
+ void appendToJson(std::string& json, const std::string& varName, const bool& value) const {
+ if (value == 0) {
+ return;
+ }
+ json += '"';
+ json += varName;
+ json += "\":";
+ json += (value ? "true" : "false");
+ json += ',';
+ }
+
void appendToJson(std::string& json, const std::string& varName, const std::string& value) const;
};