json BUGFIX metadata handling fixes
diff --git a/src/parser_json.c b/src/parser_json.c
index d14151e..130e4e4 100644
--- a/src/parser_json.c
+++ b/src/parser_json.c
@@ -759,16 +759,15 @@
 next_entry:
         instance++;
 
-        /* move into array / next entry */
+        /* move into array/next entry */
         ret = lyjson_ctx_next(lydctx->jsonctx, &status);
         LY_CHECK_GOTO(ret, cleanup);
 
         if (status == LYJSON_ARRAY_CLOSED) {
-            /* we are done, move after the array */
-            ret = lyjson_ctx_next(lydctx->jsonctx, NULL);
+            /* no more metadata */
             goto cleanup;
         }
-        LY_CHECK_GOTO(status != LYJSON_OBJECT && status != LYJSON_NULL, representation_error);
+        LY_CHECK_GOTO((status != LYJSON_OBJECT) && (status != LYJSON_NULL), representation_error);
 
         if (!node || (node->schema != prev->schema)) {
             LOGVAL(lydctx->jsonctx->ctx, LYVE_REFERENCE, "Missing JSON data instance #%u of %s:%s to be coupled with metadata.",