about summary refs log tree commit diff
path: root/src/libexpr/value-to-json.hh
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-02-25T10·25+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-02-25T10·25+0100
commitf1bdeac9864de8cd9994bb41da79f3a4d812dadc (patch)
tree9ea00480f826dc8d8d8248e11323266a42f9d4ae /src/libexpr/value-to-json.hh
parent9b05d5848c2fce73b75b3411e362c2bd48d53dcb (diff)
parent152b1d6bf9c89b4db9848475e3000821e159d479 (diff)
Merge branch 'master' into new-cli
Diffstat (limited to 'src/libexpr/value-to-json.hh')
-rw-r--r--src/libexpr/value-to-json.hh13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/libexpr/value-to-json.hh b/src/libexpr/value-to-json.hh
index f6796f2053e9..c59caf5641bc 100644
--- a/src/libexpr/value-to-json.hh
+++ b/src/libexpr/value-to-json.hh
@@ -36,7 +36,18 @@ struct JSONObject
         attr(s);
         escapeJSON(str, t);
     }
-    void attr(const string & s, int n)
+    void attr(const string & s, const char * t)
+    {
+        attr(s);
+        escapeJSON(str, t);
+    }
+    void attr(const string & s, bool b)
+    {
+        attr(s);
+        str << (b ? "true" : "false");
+    }
+    template<typename T>
+    void attr(const string & s, const T & n)
     {
         attr(s);
         str << n;