blobmsg_puts(s, (array ? " ]" : " }"), 2);
}
-char *blobmsg_format_json(struct blob_attr *attr)
+char *blobmsg_format_json(struct blob_attr *attr, bool named)
{
struct strbuf s;
s.buf = malloc(s.len);
s.pos = 0;
- blobmsg_format_element(&s, attr, true, true);
+ blobmsg_format_json_list(&s, blob_data(attr), blob_len(attr), !named);
if (!s.len)
return NULL;
return blob_buf_init(buf, BLOBMSG_TYPE_TABLE);
}
-char *blobmsg_format_json(struct blob_attr *attr);
+char *blobmsg_format_json(struct blob_attr *attr, bool named);
#define blobmsg_for_each_attr(pos, attr, rem) \
for (rem = blobmsg_data_len(attr), pos = blobmsg_data(attr); \
blobmsg_buf_init(&buf);
fill_message(&buf);
dump_message(&buf);
- fprintf(stderr, "json: %s\n", blobmsg_format_json(buf.head));
+ fprintf(stderr, "json: %s\n", blobmsg_format_json(buf.head, false), true);
if (buf.buf)
free(buf.buf);