Fixed: [Returning a string while Querying leaf-list for single entry](https://github.com/clicon/clixon/issues/326)

This commit is contained in:
Olof hagsand 2022-05-12 12:04:13 +02:00
parent 7065d6f760
commit 0c81b66ef3
6 changed files with 66 additions and 8 deletions

View file

@ -1062,15 +1062,29 @@ xml2json_cbuf(cbuf *cb,
cxobj *x,
int pretty)
{
int retval = 1;
int level = 0;
int retval = 1;
int level = 0;
yang_stmt *y;
enum array_element_type arraytype = NO_ARRAY;
cprintf(cb, "%*s{%s",
pretty?level*JSON_INDENT:0,"",
pretty?"\n":"");
if ((y = xml_spec(x)) != NULL){
switch (yang_keyword_get(y)){
case Y_LEAF_LIST:
case Y_LIST:
arraytype = SINGLE_ARRAY;
break;
default:
arraytype = NO_ARRAY;
break;
}
}
if (xml2json1_cbuf(cb,
x,
NO_ARRAY,
arraytype,
level+1,
pretty,
0,