summaryrefslogtreecommitdiffstats
path: root/src/utils-json.c
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-11-08 13:01:05 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2016-11-08 13:01:05 +0100
commit59e224c962345fdc30e3c67aa90627ad8771becf (patch)
tree3bfcc199726575774da0fdaa4e2f1a6d8b600e95 /src/utils-json.c
parent4cd8d99ab22ab339d54203bf977648af71d91499 (diff)
utils-json: add facility for arrays
Change-Id: I6d536d730af71b18e78720839522b82aed63c0d4 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/utils-json.c')
-rw-r--r--src/utils-json.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/utils-json.c b/src/utils-json.c
index c582837..74df9a9 100644
--- a/src/utils-json.c
+++ b/src/utils-json.c
@@ -95,7 +95,10 @@ int j_integer_at(struct json_object *obj, const char *key, int defval)
int j_add(struct json_object *obj, const char *key, struct json_object *val)
{
- json_object_object_add(obj, key, val);
+ if (key)
+ json_object_object_add(obj, key, val);
+ else
+ json_object_array_add(obj, val);
return 1;
}