parser json BUGFIX store all parsed nodes
Fixes #2080
diff --git a/src/parser_json.c b/src/parser_json.c
index 71544fa..ccc72a4 100644
--- a/src/parser_json.c
+++ b/src/parser_json.c
@@ -1772,14 +1772,14 @@
}
node_parsed:
- /* finally connect the parsed node */
- lydjson_maintain_children(parent, first_p, &node, lydctx->parse_opts & LYD_PARSE_ORDERED ? 1 : 0, ext);
-
/* rememeber a successfully parsed node */
if (parsed && node) {
ly_set_add(parsed, node, 1, NULL);
}
+ /* finally connect the parsed node, is zeroed */
+ lydjson_maintain_children(parent, first_p, &node, lydctx->parse_opts & LYD_PARSE_ORDERED ? 1 : 0, ext);
+
if (!parse_subtree) {
/* move after the item(s) */
r = lyjson_ctx_next(lydctx->jsonctx, &status);