summaryrefslogtreecommitdiff
path: root/lib/json.c
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2020-02-18 15:20:28 +0100
committerPhilippe Guibert <philippe.guibert@6wind.com>2020-03-31 14:38:15 +0200
commit799cc002866c077fcc4012caa8b0d604924c7e32 (patch)
treebb0cec08124831383adef2275c4bd2da626d176b /lib/json.c
parent620e23e80728b145f69bc1cc962e30085f829afa (diff)
lib: add json api to encode double values
this api can be used to encode double values. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'lib/json.c')
-rw-r--r--lib/json.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/json.c b/lib/json.c
index 991240639a..6bea3982e3 100644
--- a/lib/json.c
+++ b/lib/json.c
@@ -50,6 +50,11 @@ void json_object_int_add(struct json_object *obj, const char *key, int64_t i)
json_object_object_add(obj, key, json_object_new_int64(i));
}
+void json_object_double_add(struct json_object *obj, const char *key, double i)
+{
+ json_object_object_add(obj, key, json_object_new_double(i));
+}
+
void json_object_boolean_false_add(struct json_object *obj, const char *key)
{
json_object_object_add(obj, key, json_object_new_boolean(0));