X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Futils-json.c;h=74df9a949bf015237a372b28a6efa1ad928a70f8;hb=refs%2Fchanges%2F27%2F7327%2F2;hp=eb1f90b58247940fa9f5342a4f5845222121c066;hpb=740c64f92c24da30a8636b836a21e91fcba70463;p=src%2Fapp-framework-main.git diff --git a/src/utils-json.c b/src/utils-json.c index eb1f90b..74df9a9 100644 --- a/src/utils-json.c +++ b/src/utils-json.c @@ -1,5 +1,5 @@ /* - Copyright 2015 IoT.bzh + Copyright 2015, 2016 IoT.bzh author: José Bollo @@ -18,7 +18,7 @@ #include -#include +#include #include "utils-json.h" @@ -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; }