json vector

This commit is contained in:
Olof Hagsand 2018-01-15 21:36:42 +00:00
parent 363bd5d19d
commit 73074bf7a8

View file

@ -294,24 +294,16 @@ api_data_get2(clicon_handle h,
if (xpath_vec(xret, path, &xvec, &xlen) < 0)
goto done;
clicon_debug(1, "%s: xpath:%s xlen:%d", __FUNCTION__, path, xlen);
if (use_xml){
for (i=0; i<xlen; i++){
x = xvec[i];
#if 1 /* DEBUG */
{
cbuf *cb = cbuf_new();
clicon_xml2cbuf(cb, x, 0, 0);
clicon_debug(1, "%s x:%s", __FUNCTION__, cbuf_get(cb));
cbuf_free(cb);
}
#endif
if (use_xml){
if (clicon_xml2cbuf(cbx, x, 0, pretty) < 0) /* Dont print top object? */
goto done;
}
else{
if (xml2json_cbuf(cbx, x, pretty) < 0)
goto done;
}
else
if (xml2json_cbuf_vec(cbx, xvec, xlen, pretty) < 0)
goto done;
}
}
clicon_debug(1, "%s cbuf:%s", __FUNCTION__, cbuf_get(cbx));