parsers BUGFIX parsing operation appended to a parent
diff --git a/src/parser_json.c b/src/parser_json.c
index af04a36..a2ce567 100644
--- a/src/parser_json.c
+++ b/src/parser_json.c
@@ -1854,10 +1854,8 @@
             break;
         }
     } while (status == LYJSON_OBJECT_NEXT);
-    assert((status == LYJSON_END) || (status == LYJSON_OBJECT_CLOSED));
 
-    if ((int_opts & LYD_INTOPT_NO_SIBLINGS) && lydctx->jsonctx->in->current[0] &&
-            (lyjson_ctx_status(lydctx->jsonctx) != LYJSON_OBJECT_CLOSED)) {
+    if ((int_opts & LYD_INTOPT_NO_SIBLINGS) && lydctx->jsonctx->in->current[0] && (status != LYJSON_OBJECT_CLOSED)) {
         LOGVAL(ctx, LYVE_SYNTAX, "Unexpected sibling node.");
         r = LY_EVALID;
         LY_DPARSER_ERR_GOTO(r, rc = r, lydctx, cleanup);
@@ -1875,7 +1873,7 @@
     if (parse_opts & LYD_PARSE_SUBTREE) {
         /* check for a sibling object */
         assert(subtree_sibling);
-        if (lydctx->jsonctx->in->current[0] == ',') {
+        if (status == LYJSON_OBJECT_NEXT) {
             *subtree_sibling = 1;
 
             /* move to the next object */
diff --git a/src/tree_data.c b/src/tree_data.c
index 0da855e..22b6926 100644
--- a/src/tree_data.c
+++ b/src/tree_data.c
@@ -327,13 +327,13 @@
 
     /* set internal opts */
     case LYD_TYPE_RPC_YANG:
-        int_opts = LYD_INTOPT_RPC | LYD_INTOPT_ACTION | LYD_INTOPT_NO_SIBLINGS;
+        int_opts = LYD_INTOPT_RPC | LYD_INTOPT_ACTION | (parent ? LYD_INTOPT_WITH_SIBLINGS : LYD_INTOPT_NO_SIBLINGS);
         break;
     case LYD_TYPE_NOTIF_YANG:
-        int_opts = LYD_INTOPT_NOTIF | LYD_INTOPT_NO_SIBLINGS;
+        int_opts = LYD_INTOPT_NOTIF | (parent ? LYD_INTOPT_WITH_SIBLINGS : LYD_INTOPT_NO_SIBLINGS);
         break;
     case LYD_TYPE_REPLY_YANG:
-        int_opts = LYD_INTOPT_REPLY | LYD_INTOPT_NO_SIBLINGS;
+        int_opts = LYD_INTOPT_REPLY | (parent ? LYD_INTOPT_WITH_SIBLINGS : LYD_INTOPT_NO_SIBLINGS);
         break;
     case LYD_TYPE_DATA_YANG:
         LOGINT(ctx);
diff --git a/tests/utests/data/test_parser_json.c b/tests/utests/data/test_parser_json.c
index e9619e2..edc4372 100644
--- a/tests/utests/data/test_parser_json.c
+++ b/tests/utests/data/test_parser_json.c
@@ -46,6 +46,7 @@
             "leaf foo2 { type string; default \"default-val\"; }"
             "leaf foo3 { type uint32; }"
             "leaf foo4 { type uint64; }"
+            "rpc r1 {input {leaf l1 {type string;} leaf l2 {type string;}}}"
             "notification n2;}";
 
     UTEST_SETUP;
@@ -651,6 +652,7 @@
 test_rpc(void **state)
 {
     const char *data;
+    char *str;
     struct ly_in *in;
     struct lyd_node *tree, *op;
     const struct lyd_node *node;
@@ -700,8 +702,16 @@
     CHECK_LYD_STRING(tree, LYD_PRINT_SHRINK | LYD_PRINT_WITHSIBLINGS, data);
     lyd_free_all(tree);
 
-    /* wrong namespace, element name, whatever... */
-    /* TODO */
+    /* append to parent */
+    assert_int_equal(LY_SUCCESS, lyd_new_path(NULL, UTEST_LYCTX, "/a:r1", NULL, 0, &op));
+    assert_int_equal(LY_SUCCESS, ly_in_new_memory("{\"l1\": \"some str\", \"l2\": \"some other str\"}", &in));
+    assert_int_equal(LY_SUCCESS, lyd_parse_op(UTEST_LYCTX, op, in, LYD_JSON, LYD_TYPE_RPC_YANG, &tree, NULL));
+    ly_in_free(in, 0);
+
+    assert_int_equal(LY_SUCCESS, lyd_print_mem(&str, op, LYD_JSON, LYD_PRINT_WITHSIBLINGS | LYD_PRINT_SHRINK));
+    lyd_free_tree(op);
+    assert_string_equal(str, "{\"a:r1\":{\"l1\":\"some str\",\"l2\":\"some other str\"}}");
+    free(str);
 }
 
 static void