printer json BUGFIX correct metadata parents
diff --git a/src/printer_json.c b/src/printer_json.c
index f14f5d1..e234f92 100644
--- a/src/printer_json.c
+++ b/src/printer_json.c
@@ -476,7 +476,7 @@
 
     if (node->schema && (node->meta || wdmod)) {
         if (inner) {
-            LY_CHECK_RET(json_print_member2(pctx, NULL, LY_VALUE_JSON, NULL, 1));
+            LY_CHECK_RET(json_print_member2(pctx, lyd_parent(node), LY_VALUE_JSON, NULL, 1));
         } else {
             LY_CHECK_RET(json_print_member(pctx, node, 1));
         }
@@ -488,9 +488,9 @@
         LEVEL_PRINTED;
     } else if (!node->schema && ((struct lyd_node_opaq *)node)->attr) {
         if (inner) {
-            LY_CHECK_RET(json_print_member2(pctx, NULL, LY_VALUE_JSON, NULL, 1));
+            LY_CHECK_RET(json_print_member2(pctx, lyd_parent(node), LY_VALUE_JSON, NULL, 1));
         } else {
-            LY_CHECK_RET(json_print_member2(pctx, node, ((struct lyd_node_opaq *)node)->format,
+            LY_CHECK_RET(json_print_member2(pctx, lyd_parent(node), ((struct lyd_node_opaq *)node)->format,
                     &((struct lyd_node_opaq *)node)->name, 1));
         }
         ly_print_(pctx->out, "{%s", (DO_FORMAT ? "\n" : ""));