parser json BUGFIX printing opaque nodes as containers (#2230)
In case there are empty containers in JSON output,
they were not stored as such and term nodes were
incorrectly printed.
diff --git a/src/printer_json.c b/src/printer_json.c
index 29ca0e7..df24e3a 100644
--- a/src/printer_json.c
+++ b/src/printer_json.c
@@ -582,7 +582,6 @@
if ((any->schema->nodetype == LYS_ANYDATA) && (any->value_type != LYD_ANYDATA_DATATREE)) {
LOGINT_RET(pctx->ctx);
}
-
if (any->value_type == LYD_ANYDATA_LYB) {
uint32_t parser_options = LYD_PARSE_ONLY | LYD_PARSE_OPAQ | LYD_PARSE_STRICT;
@@ -942,7 +941,7 @@
} else if (node->hints & LYD_NODEHINT_LEAFLIST) {
ly_print_(pctx->out, ",%s%*s", DO_FORMAT ? "\n" : "", INDENT);
}
- if (node->child || (node->hints & LYD_NODEHINT_LIST)) {
+ if (node->child || (node->hints & LYD_NODEHINT_LIST) || (node->hints & LYD_NODEHINT_CONTAINER)) {
LY_CHECK_RET(json_print_inner(pctx, &node->node));
LEVEL_PRINTED;
} else {