X-Git-Url: https://git.tokkee.org/?p=sysdb.git;a=blobdiff_plain;f=src%2Fcore%2Fstore_json.c;h=a2c117b1f10d07308e7db9afd698c32933342e49;hp=c8e35fe73584632fb60bd524835862d0da00a9ce;hb=79debed9dacc5d48386124a1ee9a3f7be655fdf6;hpb=30e228e35e64b97459e92940ca1e66c790523227 diff --git a/src/core/store_json.c b/src/core/store_json.c index c8e35fe..a2c117b 100644 --- a/src/core/store_json.c +++ b/src/core/store_json.c @@ -142,11 +142,12 @@ handle_new_object(sdb_store_json_formatter_t *f, sdb_store_obj_t *obj) return 0; } - if ((f->current >= 1) && (obj->type != SDB_ATTRIBUTE)) { - /* new entry of a previous type or a new type on the same level; + if ((f->context[f->current] != SDB_HOST) + && (obj->type != SDB_ATTRIBUTE)) { + /* new entry of the same type or a parent object; * rewind to the right state */ while ((f->current > 0) - && (f->context[f->current] == obj->type)) { + && (f->context[f->current] != obj->type)) { sdb_strbuf_append(f->buf, "}]"); --f->current; }