diff --git a/src/plugins_types.c b/src/plugins_types.c
index 87515a9..6d83ca7 100644
--- a/src/plugins_types.c
+++ b/src/plugins_types.c
@@ -957,6 +957,7 @@
     struct lyxp_expr *target_path = NULL;
     struct lyxp_set set = {0};
     const char *val_str, *xp_err_msg;
+    uint32_t i;
     int r;
 
     LY_CHECK_ARG_RET(NULL, lref, node, value, errmsg, LY_EINVAL);
@@ -968,19 +969,21 @@
     /* get the canonical value */
     val_str = lyd_value_get_canonical(LYD_CTX(node), value);
 
-    /* get the path with the value */
-    r = lyplg_type_resolve_leafref_get_target_path(lref->path, node->schema, LY_VALUE_SCHEMA_RESOLVED, lref->prefixes,
-            val_str, &target_path);
-    if (r == LY_ENOT) {
-        goto cleanup;
-    } else if (r) {
-        rc = r;
-        goto cleanup;
-    }
+    if (!strchr(val_str, '\"') || !strchr(val_str, '\'')) {
+        /* get the path with the value */
+        r = lyplg_type_resolve_leafref_get_target_path(lref->path, node->schema, LY_VALUE_SCHEMA_RESOLVED, lref->prefixes,
+                val_str, &target_path);
+        if (r == LY_ENOT) {
+            goto cleanup;
+        } else if (r) {
+            rc = r;
+            goto cleanup;
+        }
+    } /* else value with both ' and ", XPath does not support that */
 
-    /* find the target data instance */
-    rc = lyxp_eval(LYD_CTX(node), target_path, node->schema->module, LY_VALUE_SCHEMA_RESOLVED, lref->prefixes,
-            node, node, tree, NULL, &set, LYXP_IGNORE_WHEN);
+    /* find the target data instance(s) */
+    rc = lyxp_eval(LYD_CTX(node), target_path ? target_path : lref->path, node->schema->module,
+            LY_VALUE_SCHEMA_RESOLVED, lref->prefixes, node, node, tree, NULL, &set, LYXP_IGNORE_WHEN);
     if (rc) {
         if (ly_errcode(LYD_CTX(node)) == rc) {
             xp_err_msg = ly_errmsg(LYD_CTX(node));
@@ -1001,7 +1004,25 @@
     }
 
     /* check the result */
-    if (!set.used) {
+    if (target_path) {
+        /* no or exact match */
+        assert(!set.used || (set.used == 1));
+        i = 0;
+    } else {
+        /* check whether any matches */
+        for (i = 0; i < set.used; ++i) {
+            if (set.val.nodes[i].type != LYXP_NODE_ELEM) {
+                continue;
+            }
+
+            if (!lref->plugin->compare(&((struct lyd_node_term *)set.val.nodes[i].node)->value, value)) {
+                break;
+            }
+        }
+    }
+
+    if (i == set.used) {
+        /* no match found */
         rc = LY_ENOTFOUND;
         if (asprintf(errmsg, LY_ERRMSG_NOLREF_VAL, val_str, lref->path->expr) == -1) {
             *errmsg = NULL;
@@ -1009,10 +1030,8 @@
         }
         goto cleanup;
     }
-    assert(set.used == 1);
-
     if (target) {
-        *target = set.val.nodes[0].node;
+        *target = set.val.nodes[i].node;
     }
 
 cleanup:
diff --git a/tests/utests/types/leafref.c b/tests/utests/types/leafref.c
index d304b2e..e208aec 100644
--- a/tests/utests/types/leafref.c
+++ b/tests/utests/types/leafref.c
@@ -64,8 +64,8 @@
 static void
 test_data_xml(void **state)
 {
-    const char *schema, *schema2, *data2;
-    struct lyd_node *tree2;
+    const char *schema, *schema2, *schema3, *data;
+    struct lyd_node *tree;
 
     /* xml test */
     schema = MODULE_CREATE_YANG("defs", "leaf lref {type leafref {path /leaflisttarget; require-instance true;}}"
@@ -97,21 +97,35 @@
             "<str-norestr xmlns=\"urn:tests:defs\">y</str-norestr>",
             "defs", "xmlns:a=\"urn:tests:defs\"", "a:lref2", "y", STRING, "y");
 
-    data2 = "<str-norestr xmlns=\"urn:tests:defs\">y</str-norestr>"
+    data = "<str-norestr xmlns=\"urn:tests:defs\">y</str-norestr>"
             "<c xmlns=\"urn:tests:leafrefs\"><l><id>x</id><value>x</value><lr1>y</lr1></l></c>";
-    CHECK_PARSE_LYD_PARAM(data2, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_SUCCESS, tree2);
-    CHECK_LYD_NODE_TERM((struct lyd_node_term *)lyd_child(lyd_child(tree2->next->next)->next)->next->next,
+    CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_SUCCESS, tree);
+    CHECK_LYD_NODE_TERM((struct lyd_node_term *)lyd_child(lyd_child(tree->next->next)->next)->next->next,
             0, 0, 0, 1, 1, STRING, "y");
-    lyd_free_all(tree2);
+    lyd_free_all(tree);
 
-    data2 = "<list xmlns=\"urn:tests:defs\"><id>x</id><targets>a</targets><targets>b</targets></list>"
+    data = "<list xmlns=\"urn:tests:defs\"><id>x</id><targets>a</targets><targets>b</targets></list>"
             "<list xmlns=\"urn:tests:defs\"><id>y</id><targets>c</targets><targets>d</targets></list>"
             "<c xmlns=\"urn:tests:leafrefs\"><x><x>y</x></x>"
             "<l><id>x</id><value>x</value><lr3>c</lr3></l></c>";
-    CHECK_PARSE_LYD_PARAM(data2, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_SUCCESS, tree2);
-    CHECK_LYD_NODE_TERM((struct lyd_node_term *)lyd_child(lyd_child(tree2->next->next->next)->next)->next->next,
+    CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_SUCCESS, tree);
+    CHECK_LYD_NODE_TERM((struct lyd_node_term *)lyd_child(lyd_child(tree->next->next->next)->next)->next->next,
             0, 0, 0, 1, 1, STRING, "c");
-    lyd_free_all(tree2);
+    lyd_free_all(tree);
+
+    schema3 = MODULE_CREATE_YANG("simple", "leaf l1 {type leafref {path \"../target\";}}"
+            "leaf target {type string;}");
+    UTEST_ADD_MODULE(schema3, LYS_IN_YANG, NULL, NULL);
+
+    data = "<l1 xmlns=\"urn:tests:simple\">&quot;*&quot;&#39;</l1>"
+            "<target xmlns=\"urn:tests:simple\">&quot;*&quot;&#39;</target>";
+    CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_SUCCESS, tree);
+    lyd_free_all(tree);
+
+    data = "<l1 xmlns=\"urn:tests:simple\">&quot;*&#39;&quot;</l1>"
+            "<target xmlns=\"urn:tests:simple\">&quot;*&#39;&quot;</target>";
+    CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_SUCCESS, tree);
+    lyd_free_all(tree);
 
     /* invalid value */
     TEST_ERROR_XML2("<leaflisttarget xmlns=\"urn:tests:defs\">x</leaflisttarget>",
@@ -158,6 +172,32 @@
 }
 
 static void
+test_data_json(void **state)
+{
+    const char *schema, *data;
+    struct lyd_node *tree;
+
+    /* json test */
+    schema = MODULE_CREATE_YANG("simple", "leaf l1 {type leafref {path \"../target\";}}"
+            "leaf target {type string;}");
+    UTEST_ADD_MODULE(schema, LYS_IN_YANG, NULL, NULL);
+
+    data = "{"
+            "  \"simple:l1\":\"\\\"*\\\"'\","
+            "  \"simple:target\":\"\\\"*\\\"'\""
+            "}";
+    CHECK_PARSE_LYD_PARAM(data, LYD_JSON, 0, LYD_VALIDATE_PRESENT, LY_SUCCESS, tree);
+    lyd_free_all(tree);
+
+    data = "{"
+            "  \"simple:l1\":\"\\\"*'\\\"\","
+            "  \"simple:target\":\"\\\"*'\\\"\""
+            "}";
+    CHECK_PARSE_LYD_PARAM(data, LYD_JSON, 0, LYD_VALIDATE_PRESENT, LY_SUCCESS, tree);
+    lyd_free_all(tree);
+}
+
+static void
 test_plugin_lyb(void **state)
 {
     const char *schema;
@@ -174,6 +214,7 @@
 {
     const struct CMUnitTest tests[] = {
         UTEST(test_data_xml),
+        UTEST(test_data_json),
         UTEST(test_plugin_lyb),
     };
 
