diff --git a/src/common.h b/src/common.h
index 8010c0b..f7faa86 100644
--- a/src/common.h
+++ b/src/common.h
@@ -343,6 +343,11 @@
 int ly_strncmp(const char *refstr, const char *str, size_t str_len);
 
 /**
+ * @brief Wrapper around strlen() to handle NULL strings.
+ */
+#define ly_strlen(STR) (STR ? strlen(STR) : 0)
+
+/**
  * @brief Get UTF8 code point of the next character in the input string.
  *
  * @param[in,out] input Input string to process, updated according to the processed/read data.
@@ -454,7 +459,7 @@
                                    const char **value, size_t *value_len, const char **errmsg);
 
 /**
- * @brief ly_clb_get_prefix implementation for JSON. For its simplicity, this implementation is used
+ * @brief ly_get_prefix_clb implementation for JSON. For its simplicity, this implementation is used
  * internally for various purposes.
  *
  * Implemented in printer_json.c
diff --git a/src/json.h b/src/json.h
index 8373284..7b2221e 100644
--- a/src/json.h
+++ b/src/json.h
@@ -52,6 +52,9 @@
 };
 
 struct lyjson_ctx {
+    const struct ly_ctx *ctx;
+    uint64_t line;          /* current line */
+    struct ly_in *in;       /* input structure */
 
     struct ly_set status;   /* stack of LYJSON_PARSER_STATUS values corresponding to the JSON items being processed */
 
diff --git a/src/log.h b/src/log.h
index e71608f..9176a04 100644
--- a/src/log.h
+++ b/src/log.h
@@ -174,6 +174,7 @@
     LYVE_XPATH,        /**< invalid XPath expression */
     LYVE_SEMANTICS,    /**< generic semantic error */
     LYVE_SYNTAX_XML,   /**< XML-related syntax error */
+    LYVE_SYNTAX_JSON,  /**< JSON-related syntax error */
     LYVE_DATA,         /**< YANG data does not reflect some of the module restrictions */
 
     LYVE_OTHER         /**< Unknown error */
diff --git a/src/lyb.h b/src/lyb.h
index bc159f3..000fab3 100644
--- a/src/lyb.h
+++ b/src/lyb.h
@@ -18,6 +18,7 @@
 #include <stddef.h>
 #include <stdint.h>
 
+#include "parser_internal.h"
 #include "set.h"
 #include "tree.h"
 
@@ -26,10 +27,13 @@
 struct lyd_node;
 struct lysc_node;
 
-/**
- * @brief Internal structure for LYB parser/printer.
- */
-struct lyd_lyb_ctx {
+struct lylyb_ctx {
+    const struct ly_ctx *ctx;
+    uint64_t line;             /* current line */
+    struct ly_in *in;          /* input structure */
+
+    const struct lys_module **models;
+
     struct lyd_lyb_subtree {
         size_t written;
         size_t position;
@@ -37,24 +41,6 @@
     } *subtrees;
     LY_ARRAY_COUNT_TYPE subtree_size;
 
-    const struct ly_ctx *ctx;
-    union {
-        struct {
-            int parse_options;
-            int validate_options;
-        };
-        int print_options;
-    };
-
-    /* LYB parser only */
-    struct ly_in *in;
-    int int_opts;
-    const struct lys_module **models;
-    struct ly_set unres_node_type;
-    struct ly_set unres_meta_type;
-    struct ly_set when_check;
-    struct lyd_node *op_ntf;
-
     /* LYB printer only */
     struct lyd_lyb_sib_ht {
         struct lysc_node *first_sibling;
@@ -63,6 +49,39 @@
 };
 
 /**
+ * @brief Internal structure for LYB parser/printer.
+ *
+ * Note that the structure maps to the lyd_ctx which is common for all the data parsers
+ */
+struct lyd_lyb_ctx {
+    union {
+        struct {
+            uint32_t parse_options;        /**< various @ref dataparseroptions. */
+            uint32_t validate_options;     /**< various @ref datavalidationoptions. */
+        };
+        uint32_t print_options;
+    };
+    uint32_t int_opts;             /**< internal data parser options */
+    uint32_t path_len;             /**< used bytes in the path buffer */
+    char path[LYD_PARSER_BUFSIZE]; /**< buffer for the generated path */
+    struct ly_set unres_node_type; /**< set of nodes validated with LY_EINCOMPLETE result */
+    struct ly_set unres_meta_type; /**< set of metadata validated with LY_EINCOMPLETE result */
+    struct ly_set when_check;      /**< set of nodes with "when" conditions */
+    struct lyd_node *op_node;      /**< if an RPC/action/notification is being parsed, store the pointer to it */
+
+    /* callbacks */
+    lyd_ctx_free_clb free;           /* destructor */
+    ly_resolve_prefix_clb resolve_prefix;
+
+    struct lylyb_ctx *lybctx;      /* lyb format context */
+};
+
+/**
+ * @brief Destructor for the lylyb_ctx structure
+ */
+void lyd_lyb_ctx_free(struct lyd_ctx *lydctx);
+
+/**
  * LYB format
  *
  * Unlike XML or JSON, it is binary format so most data are represented in similar way but in binary.
diff --git a/src/parser.c b/src/parser.c
index fe8528b..e84dc58 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -28,7 +28,9 @@
 #include "compat.h"
 #include "dict.h"
 #include "log.h"
+#include "parser_data.h"
 #include "parser_internal.h"
+#include "tree_data_internal.h"
 #include "tree_schema_internal.h"
 
 API LY_IN_TYPE
@@ -353,3 +355,83 @@
     in->current += count;
     return LY_SUCCESS;
 }
+
+void
+lyd_ctx_free(struct lyd_ctx *lydctx)
+{
+    ly_set_erase(&lydctx->unres_node_type, NULL);
+    ly_set_erase(&lydctx->unres_meta_type, NULL);
+    ly_set_erase(&lydctx->when_check, NULL);
+}
+
+LY_ERR
+lyd_parser_check_schema(struct lyd_ctx *lydctx, const struct lysc_node *snode)
+{
+    /* alternatively, we could provide line for the error messages, but it doesn't work for the LYB format */
+
+    if ((lydctx->parse_options & LYD_PARSE_NO_STATE) && (snode->flags & LYS_CONFIG_R)) {
+        LOGVAL(lydctx->data_ctx->ctx, LY_VLOG_LYSC, snode, LY_VCODE_INNODE, "state", snode->name);
+        return LY_EVALID;
+    }
+
+    if (snode->nodetype & (LYS_RPC | LYS_ACTION)) {
+        if (lydctx->int_opts & LYD_INTOPT_RPC) {
+            if (lydctx->op_node) {
+                LOGVAL(lydctx->data_ctx->ctx, LY_VLOG_LYSC, snode, LYVE_DATA, "Unexpected %s element \"%s\", %s \"%s\" already parsed.",
+                       lys_nodetype2str(snode->nodetype), snode->name,
+                       lys_nodetype2str(lydctx->op_node->schema->nodetype), lydctx->op_node->schema->name);
+                return LY_EVALID;
+            }
+        } else {
+            LOGVAL(lydctx->data_ctx->ctx, LY_VLOG_LYSC, snode, LYVE_DATA, "Unexpected %s element \"%s\".",
+                   lys_nodetype2str(snode->nodetype), snode->name);
+            return LY_EVALID;
+        }
+    } else if (snode->nodetype == LYS_NOTIF) {
+        if (lydctx->int_opts & LYD_INTOPT_NOTIF) {
+            if (lydctx->op_node) {
+                LOGVAL(lydctx->data_ctx->ctx, LY_VLOG_LYSC, snode, LYVE_DATA, "Unexpected %s element \"%s\", %s \"%s\" already parsed.",
+                       lys_nodetype2str(snode->nodetype), snode->name,
+                       lys_nodetype2str(lydctx->op_node->schema->nodetype), lydctx->op_node->schema->name);
+                return LY_EVALID;
+            }
+        } else {
+            LOGVAL(lydctx->data_ctx->ctx, LY_VLOG_LYSC, snode, LYVE_DATA, "Unexpected %s element \"%s\".",
+                   lys_nodetype2str(snode->nodetype), snode->name);
+            return LY_EVALID;
+        }
+    }
+
+    return LY_SUCCESS;
+}
+
+LY_ERR
+lyd_parser_create_term(struct lyd_ctx *lydctx, const struct lysc_node *schema, const char *value, size_t value_len,
+                       int *dynamic, int value_hints, ly_resolve_prefix_clb get_prefix, void *prefix_data,
+                       LYD_FORMAT format, struct lyd_node **node)
+{
+    LY_ERR ret;
+
+    ret = lyd_create_term(schema, value, value_len, dynamic, value_hints, get_prefix, prefix_data, format, node);
+    if (ret == LY_EINCOMPLETE) {
+        if (!(lydctx->parse_options & LYD_PARSE_ONLY)) {
+            ly_set_add(&lydctx->unres_node_type, *node, LY_SET_OPT_USEASLIST);
+        }
+        ret = LY_SUCCESS;
+    }
+    return ret;
+}
+
+LY_ERR
+lyd_parser_create_meta(struct lyd_ctx *lydctx, struct lyd_node *parent, struct lyd_meta **meta, const struct lys_module *mod,
+                       const char *name, size_t name_len, const char *value, size_t value_len, int *dynamic, int value_hints,
+                       ly_resolve_prefix_clb resolve_prefix, void *prefix_data, LYD_FORMAT format, const struct lysc_node *ctx_snode)
+{
+    LY_ERR ret;
+    ret = lyd_create_meta(parent, meta, mod, name, name_len, value, value_len, dynamic, value_hints, resolve_prefix, prefix_data, format, ctx_snode);
+    if (ret == LY_EINCOMPLETE) {
+        ly_set_add(&lydctx->unres_meta_type, *meta, LY_SET_OPT_USEASLIST);
+        ret = LY_SUCCESS;
+    }
+    return ret;
+}
diff --git a/src/parser_data.h b/src/parser_data.h
index de9f992..a2bac8b 100644
--- a/src/parser_data.h
+++ b/src/parser_data.h
@@ -220,8 +220,9 @@
  * @param[in] format Format of the input data to be parsed.
  * @param[out] tree Resulting full RPC/action reply tree built from the input data. The returned data are expected to be freed using lyd_free_all().
  * The reply tree always includes duplicated operation node (and its parents) of the @p request, so in contrast to YANG data tree,
- * the result of parsing RPC/action reply cannot be NULL until an error occurs.
- * @param[out] op Optional pointer to the actual operation node inside the full action reply @p tree, useful only for action.
+ * the result of parsing RPC/action reply cannot be NULL until an error occurs. At least one of the @p tree and @p op output variables must be provided.
+ * @param[out] op Pointer to the actual operation node inside the full action reply @p tree, useful only for action. At least one of the @p op
+ * and @p tree output variables must be provided.
  * @return LY_SUCCESS in case of successful parsing (and validation).
  * @return LY_ERR value in case of error. Additional error information can be obtained from the request's context using ly_err* functions.
  */
diff --git a/src/parser_internal.h b/src/parser_internal.h
index f60e5bd..b2c4f15 100644
--- a/src/parser_internal.h
+++ b/src/parser_internal.h
@@ -28,6 +28,40 @@
  */
 #define LYD_VALIDATE_OPTS_MASK 0x0000FFFF
 
+struct lyd_ctx;
+/**
+ * @brief Callback for lyd_ctx to free the structure
+ *
+ * @param[in] ctx Data parser context to free.
+ */
+typedef void (*lyd_ctx_free_clb)(struct lyd_ctx *ctx);
+
+/**
+ * @brief Internal (common) context for YANG data parsers.
+ */
+struct lyd_ctx {
+    uint32_t parse_options;        /**< various @ref dataparseroptions. */
+    uint32_t validate_options;     /**< various @ref datavalidationoptions. */
+    uint32_t int_opts;             /**< internal data parser options */
+    uint32_t path_len;             /**< used bytes in the path buffer */
+#define LYD_PARSER_BUFSIZE 4078
+    char path[LYD_PARSER_BUFSIZE]; /**< buffer for the generated path */
+    struct ly_set unres_node_type; /**< set of nodes validated with LY_EINCOMPLETE result */
+    struct ly_set unres_meta_type; /**< set of metadata validated with LY_EINCOMPLETE result */
+    struct ly_set when_check;      /**< set of nodes with "when" conditions */
+    struct lyd_node *op_node;      /**< if an RPC/action/notification is being parsed, store the pointer to it */
+
+    /* callbacks */
+    lyd_ctx_free_clb free;             /* destructor */
+    ly_resolve_prefix_clb resolve_prefix;
+
+    struct {
+        const struct ly_ctx *ctx;
+        uint64_t line;             /* current line */
+        struct ly_in *in;          /* input structure */
+    } *data_ctx;                   /* generic pointer supposed to map to and access (common part of) XML/JSON/... parser contexts */
+};
+
 /**
  * @brief Parser input structure specifying where the data are read.
  */
@@ -48,6 +82,11 @@
 };
 
 /**
+ * @brief Common part of the lyd_ctx_free_t callbacks.
+ */
+void lyd_ctx_free(struct lyd_ctx *);
+
+/**
  * @brief Read bytes from an input.
  *
  * @param[in] in Input structure.
@@ -115,4 +154,33 @@
 LY_ERR yin_parse_submodule(struct lys_yin_parser_ctx **yin_ctx, struct ly_ctx *ctx, struct lys_parser_ctx *main_ctx,
                            struct ly_in *in, struct lysp_submodule **submod);
 
+/**
+ * @brief Check that a data node representing the @p snode is suitable based on options.
+ *
+ * @param[in] lydctx Common data parsers context.
+ * @param[in] snode Schema node to check.
+ * @return LY_SUCCESS or LY_EVALID
+ */
+LY_ERR lyd_parser_check_schema(struct lyd_ctx *lydctx, const struct lysc_node *snode);
+
+/**
+ * @brief Wrapper around lyd_create_term() for data parsers.
+ *
+ * @param[in] lydctx Data parser context.
+ * @param[in] value_hints Data parser's hint for the value's type.
+ */
+LY_ERR lyd_parser_create_term(struct lyd_ctx *lydctx, const struct lysc_node *schema, const char *value, size_t value_len,
+                              int *dynamic, int value_hints, ly_resolve_prefix_clb get_prefix, void *prefix_data,
+                              LYD_FORMAT format, struct lyd_node **node);
+
+/**
+ * @brief Wrapper around lyd_create_meta() for data parsers.
+ *
+ * @param[in] lydctx Data parser context.
+ * @param[in] value_hints [Value hint](@ref lydvalueparseopts) from the parser regarding the value type.
+ */
+LY_ERR lyd_parser_create_meta(struct lyd_ctx *lydctx, struct lyd_node *parent, struct lyd_meta **meta, const struct lys_module *mod,
+                              const char *name, size_t name_len, const char *value, size_t value_len, int *dynamic, int value_hints,
+                              ly_resolve_prefix_clb resolve_prefix, void *prefix_data, LYD_FORMAT format, const struct lysc_node *ctx_snode);
+
 #endif /* LY_PARSER_INTERNAL_H_ */
diff --git a/src/parser_json.c b/src/parser_json.c
index 3163693..37ee765 100644
--- a/src/parser_json.c
+++ b/src/parser_json.c
@@ -3,7 +3,7 @@
  * @author Radek Krejci <rkrejci@cesnet.cz>
  * @brief JSON data parser for libyang
  *
- * Copyright (c) 2019 CESNET, z.s.p.o.
+ * Copyright (c) 2020 CESNET, z.s.p.o.
  *
  * This source code is licensed under BSD 3-Clause License (the "License").
  * You may not use this file except in compliance with the License.
@@ -14,6 +14,7 @@
 
 #define _GNU_SOURCE
 
+#include <assert.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -21,23 +22,1846 @@
 #include "compat.h"
 #include "config.h"
 #include "context.h"
+#include "json.h"
+#include "parser_internal.h"
+#include "tree_data.h"
+#include "tree_data_internal.h"
+#include "tree_schema.h"
+#include "validation.h"
 
 /**
- * @brief JSON-parser's implementation of ly_type_resolve_prefix() callback to provide mapping between prefixes used
- * in the values to the schema via context module names.
+ * @brief Internal context for JSON YANG data parser.
+ *
+ * Note that the structure maps to the lyd_ctx which is common for all the data parsers
+ */
+struct lyd_json_ctx {
+    uint32_t parse_options;        /**< various @ref dataparseroptions. */
+    uint32_t validate_options;     /**< various @ref datavalidationoptions. */
+    uint32_t int_opts;             /**< internal data parser options */
+    uint32_t path_len;             /**< used bytes in the path buffer */
+    char path[LYD_PARSER_BUFSIZE]; /**< buffer for the generated path */
+    struct ly_set unres_node_type; /**< set of nodes validated with LY_EINCOMPLETE result */
+    struct ly_set unres_meta_type; /**< set of metadata validated with LY_EINCOMPLETE result */
+    struct ly_set when_check;      /**< set of nodes with "when" conditions */
+    struct lyd_node *op_node;      /**< if an RPC/action/notification is being parsed, store the pointer to it */
+
+    /* callbacks */
+    lyd_ctx_free_clb free;           /* destructor */
+    ly_resolve_prefix_clb resolve_prefix;
+
+    struct lyjson_ctx *jsonctx;    /**< JSON context */
+};
+
+/**
+ * @brief Free the JSON data parser context.
+ *
+ * JSON implementation of lyd_ctx_free_clb().
+ */
+static void
+lyd_json_ctx_free(struct lyd_ctx *lydctx)
+{
+    struct lyd_json_ctx *ctx = (struct lyd_json_ctx *)lydctx;
+
+    if (lydctx) {
+        lyd_ctx_free(lydctx);
+        lyjson_ctx_free(ctx->jsonctx);
+        free(ctx);
+    }
+}
+
+/**
+ * @brief JSON implementation of ly_resolve_prefix_clb.
  */
 const struct lys_module *
 lydjson_resolve_prefix(const struct ly_ctx *ctx, const char *prefix, size_t prefix_len, void *UNUSED(parser))
 {
-    const struct lys_module *mod;
-    char *name;
+    return ly_ctx_get_module_implemented2(ctx, prefix, prefix_len);
+}
 
-    name = strndup(prefix, prefix_len);
-    if (!name) {
-        return NULL;
+/**
+ * @brief Parse JSON member-name as [\@][prefix:][name]
+ *
+ * \@ - metadata flag, maps to 1 in @p is_attr_p
+ * prefix - name of the module of the data node
+ * name - name of the data node
+ *
+ * All the output parameter are mandatory. Function only parse the member-name, all the appropriate checks are up to the caller.
+ *
+ * @param[in] value String to parse
+ * @param[in] value_len Length of the @p str.
+ * @param[out] name_p Pointer to the beginning of the parsed name.
+ * @param[out] name_len_p Pointer to the length of the parsed name.
+ * @param[out] prefix_p Pointer to the beginning of the parsed prefix. If the member-name does not contain prefix, result is NULL.
+ * @param[out] prefix_len_p Pointer to the length of the parsed prefix. If the member-name does not contain prefix, result is 0.
+ * @param[out] is_attr_p Pointer to the metadata flag, set to 1 if the member-name contains \@, 0 otherwise.
+ */
+static void
+lydjson_parse_name(const char *value, size_t value_len, const char **name_p, size_t *name_len_p, const char **prefix_p, size_t *prefix_len_p, int *is_attr_p)
+{
+    const char *name, *prefix = NULL;
+    size_t name_len, prefix_len = 0;
+    int is_attr = 0;
+
+    name = memchr(value, ':', value_len);
+    if (name != NULL) {
+        prefix = value;
+        if (*prefix == '@') {
+            is_attr = 1;
+            prefix++;
+        }
+        prefix_len = name - prefix;
+        name++;
+        name_len = value_len - (prefix_len + 1) - is_attr;
+    } else {
+        name = value;
+        if (name[0] == '@') {
+            is_attr = 1;
+            name++;
+        }
+        name_len = value_len - is_attr;
     }
 
-    mod = ly_ctx_get_module_implemented(ctx, name);
-    free(name);
-    return mod;
+    *name_p = name;
+    *name_len_p = name_len;
+    *prefix_p = prefix;
+    *prefix_len_p = prefix_len;
+    *is_attr_p = is_attr;
+}
+
+/**
+ * @brief Get correct prefix (module_name) inside the @p node.
+ *
+ * @param[in] node Data node to get inherited prefix.
+ * @param[in] local_prefix Local prefix to replace the inherited prefix.
+ * @param[in] local_prefix_len Length of the @p local_prefix string. In case of 0, the inherited prefix is taken.
+ * @param[out] prefix_p Pointer to the resulting prefix string, Note that the result can be NULL in case of no local prefix
+ * and no context @p node to get inherited prefix.
+ * @param[out] prefix_len_p Pointer to the length of the resulting @p prefix_p string. Note that the result can be 0 in case
+ * of no local prefix and no context @p node to get inherited prefix.
+ * @return LY_ERR value.
+ */
+static LY_ERR
+lydjson_get_node_prefix(struct lyd_node *node, const char *local_prefix, size_t local_prefix_len, const char **prefix_p, size_t *prefix_len_p)
+{
+    struct lyd_node_opaq *onode;
+    const char *module_name = NULL;
+
+    assert(prefix_p && prefix_len_p);
+
+    if (local_prefix_len) {
+        *prefix_p = local_prefix;
+        *prefix_len_p = local_prefix_len;
+        return LY_SUCCESS;
+    }
+
+    *prefix_p = NULL;
+    while (node) {
+        if (node->schema) {
+            *prefix_p = node->schema->module->name;
+            break;
+        }
+        onode = (struct lyd_node_opaq*)node;
+        if (onode->prefix.module_name) {
+            *prefix_p = onode->prefix.module_name;
+            break;
+        } else if (onode->prefix.id) {
+            *prefix_p = onode->prefix.id;
+            break;
+        }
+        node = (struct lyd_node*)node->parent;
+    }
+    *prefix_len_p = ly_strlen(module_name);
+
+    return LY_SUCCESS;
+}
+
+/**
+ * @brief Get schema node corresponding to the input parameters.
+ *
+ * @param[in] lydctx JSON data parser context.
+ * @param[in] is_attr Flag if the reference to the node is an attribute, for logging only.
+ * @param[in] prefix Requested node's prefix (module name).
+ * @param[in] prefix_len Length of the @p prefix.
+ * @param[in] name Requested node's name.
+ * @param[in] name_len Length of the @p name.
+ * @param[in] parent Parent of the node beeing processed, can be NULL in case of top-level. Also the opaq node with LYD_NODE_OPAQ_ISENVELOPE hint
+ * is accepted for searching top-level nodes.
+ * @param[out] snode_p Pointer to the found schema node corresponding to the input parameters.
+ * @return LY_SUCCES on success, note that even in this case the returned value of @p snode_p can be NULL, so the data are expected to be parsed as opaq.
+ * @return LY_EVALID on failure, error message is logged
+ * @return LY_ENOT in case the input data are expected to be skipped
+ */
+static LY_ERR
+lydjson_get_snode(const struct lyd_json_ctx *lydctx, int is_attr, const char *prefix, size_t prefix_len, const char *name, size_t name_len,
+                  const struct lyd_node_inner *parent, const struct lysc_node **snode_p)
+{
+    struct lys_module *mod = NULL;
+
+    /* leave if-feature check for validation */
+    int getnext_opts = LYS_GETNEXT_NOSTATECHECK | (lydctx->int_opts & LYD_INTOPT_REPLY ? LYS_GETNEXT_OUTPUT : 0);
+
+    /* init return value */
+    *snode_p = NULL;
+
+    /* get the element module */
+    if (prefix_len || (parent && !parent->schema && (((struct lyd_node_opaq*)parent)->hint & LYD_NODE_OPAQ_ISENVELOPE))) {
+        if (!prefix_len) {
+            /* opaq parent (envelope) - the second part of the condition */
+            lydjson_get_node_prefix((struct lyd_node*)parent, NULL, 0, &prefix, &prefix_len);
+        }
+        mod = ly_ctx_get_module_implemented2(lydctx->jsonctx->ctx, prefix, prefix_len);
+    } else if (parent) {
+        if (parent->schema) {
+            mod = parent->schema->module;
+        }
+    } else {
+        LOGVAL(lydctx->jsonctx->ctx, LY_VLOG_LYD, parent, LYVE_SYNTAX_JSON, "Top-level JSON object member \"%.*s\" must be namespace-qualified.",
+               is_attr ? name_len + 1 : name_len, is_attr ? name - 1 : name);
+        return LY_EVALID;
+    }
+    if (!mod) {
+        if (lydctx->parse_options & LYD_PARSE_STRICT) {
+            LOGVAL(lydctx->jsonctx->ctx, LY_VLOG_LYD, parent, LYVE_REFERENCE, "No module named \"%.*s\" in the context.", prefix_len, prefix);
+            return LY_EVALID;
+        }
+        if (!(lydctx->parse_options & LYD_PARSE_OPAQ)) {
+            return LY_ENOT;
+        }
+    }
+
+    if (parent && !parent->schema && (((struct lyd_node_opaq*)parent)->hint & LYD_NODE_OPAQ_ISENVELOPE)) {
+        /* ignore the envelope parent when searchinf for the schema node */
+        parent = NULL;
+    }
+
+    /* get the schema node */
+    if (mod && (!parent || parent->schema)) {
+        *snode_p = lys_find_child(parent ? parent->schema : NULL, mod, name, name_len, 0, getnext_opts);
+        if (!*snode_p) {
+            if (lydctx->parse_options & LYD_PARSE_STRICT) {
+                LOGVAL(lydctx->jsonctx->ctx, LY_VLOG_LYD, parent, LYVE_REFERENCE, "Node \"%.*s\" not found in the \"%s\" module.",
+                    name_len, name, mod->name);
+                return LY_EVALID;
+            } else if (!(lydctx->parse_options & LYD_PARSE_OPAQ)) {
+                /* skip element with children */
+                return LY_ENOT;
+            }
+        } else {
+            /* check that schema node is valid and can be used */
+            LY_CHECK_RET(lyd_parser_check_schema((struct lyd_ctx *)lydctx, *snode_p));
+        }
+    }
+
+    return LY_SUCCESS;
+}
+
+/**
+ * @brief Skip the currently open JSON object/array
+ * @param[in] jsonctx JSON context with the input data to skip.
+ * @return LY_ERR value.
+ */
+static LY_ERR
+lydjson_data_skip(struct lyjson_ctx *jsonctx)
+{
+    enum LYJSON_PARSER_STATUS status, current;
+    size_t sublevels = 1;
+
+    status = lyjson_ctx_status(jsonctx, 0);
+
+    /* skip after the content */
+    do {
+        LY_CHECK_RET(lyjson_ctx_next(jsonctx, &current));
+        if (current == status) {
+            sublevels++;
+        } else if (current == status + 1) {
+            sublevels--;
+        }
+    } while (current != status + 1 && sublevels);
+    /* open the next sibling */
+    LY_CHECK_RET(lyjson_ctx_next(jsonctx, NULL));
+
+    return LY_SUCCESS;
+}
+
+/**
+ * @brief Go through the @p value and find all possible prefixes and store them in @p val_prefs_p [sized array](@ref sizedarrays).
+ *
+ * @param[in] ctx libyang context
+ * @param[in] value Pointer to the beginning of the value to check.
+ * @param[in] value_len Length of the string to examine in @p value.
+ * @param[out] val_prefs_p Pointer to the resulting [sized array](@ref sizedarrays) of found prefixes. NULL in case there are no prefixes.
+ * @return LY_EMEM on memory allocation failure.
+ * @return LY_SUCCESS on success, empty @p val_prefs_p (NULL) is valid result if there are no possible prefixes
+ */
+static LY_ERR
+lydjson_get_value_prefixes(const struct ly_ctx *ctx, const char *value, size_t value_len, struct ly_prefix **val_prefs_p)
+{
+    LY_ERR ret;
+    LY_ARRAY_COUNT_TYPE u;
+    uint32_t c;
+    const char *start, *stop;
+    struct ly_prefix *prefixes = NULL;
+    size_t len;
+
+    for (stop = start = value; (size_t)(stop - value) < value_len; start = stop) {
+        size_t bytes;
+        ly_getutf8(&stop, &c, &bytes);
+        if (is_yangidentstartchar(c)) {
+            for (ly_getutf8(&stop, &c, &bytes);
+                    is_yangidentchar(c) && (size_t)(stop - value) < value_len;
+                    ly_getutf8(&stop, &c, &bytes));
+            stop = stop - bytes;
+            if (*stop == ':') {
+                /* we have a possible prefix */
+                struct ly_prefix *p = NULL;
+
+                len = stop - start;
+
+                /* check whether we do not already have this prefix stored */
+                LY_ARRAY_FOR(prefixes, u) {
+                    if (!ly_strncmp(prefixes[u].id, start, len)) {
+                        p = &prefixes[u];
+                        break;
+                    }
+                }
+                if (!p) {
+                    LY_ARRAY_NEW_GOTO(ctx, prefixes, p, ret, error);
+                    p->id = lydict_insert(ctx, start, len);
+                    p->module_name = lydict_insert(ctx, start, len);
+                } /* else the prefix already present */
+            }
+            stop = stop + bytes;
+        }
+    }
+
+    *val_prefs_p = prefixes;
+    return LY_SUCCESS;
+
+error:
+    LY_ARRAY_FOR(prefixes, u) {
+        lydict_remove(ctx, prefixes[u].id);
+        lydict_remove(ctx, prefixes[u].module_name);
+    }
+    LY_ARRAY_FREE(prefixes);
+    return ret;
+}
+
+/**
+ * @brief Check that the input data are parseable as the @p list.
+ *
+ * Checks for all the list's keys. Function does not revert the context state.
+ *
+ * @param[in] jsonctx JSON parser context.
+ * @param[in] list List schema node corresponding to the input data object.
+ * @return LY_SUCCESS in case the data are ok for the @p list
+ * @return LY_ENOT in case the input data are not sufficient to fully parse the list instance.
+ */
+static LY_ERR
+lydjson_check_list(struct lyjson_ctx *jsonctx, const struct lysc_node *list)
+{
+    LY_ERR ret = LY_SUCCESS;
+    enum LYJSON_PARSER_STATUS status = lyjson_ctx_status(jsonctx, 0);
+    struct ly_set key_set = {0};
+    const struct lysc_node *snode;
+    uint32_t i, status_count;
+
+    assert(list && (list->nodetype == LYS_LIST));
+    assert(status == LYJSON_OBJECT);
+
+    /* get all keys into a set (keys do not have if-features or anything) */
+    snode = NULL;
+    while ((snode = lys_getnext(snode, list, NULL, LYS_GETNEXT_NOSTATECHECK)) && (snode->flags & LYS_KEY)) {
+        ly_set_add(&key_set, (void *)snode, LY_SET_OPT_USEASLIST);
+    }
+
+    if (status != LYJSON_OBJECT_EMPTY) {
+        status_count = jsonctx->status.count;
+
+        while (key_set.count && status != LYJSON_OBJECT_CLOSED) {
+            const char *name, *prefix;
+            size_t name_len, prefix_len;
+            int is_attr;
+
+            /* match the key */
+            snode = NULL;
+            lydjson_parse_name(jsonctx->value, jsonctx->value_len, &name, &name_len, &prefix, &prefix_len, &is_attr);
+
+            if (!is_attr && !prefix) {
+                for (i = 0; i < key_set.count; ++i) {
+                    snode = (const struct lysc_node *)key_set.objs[i];
+                    if (!ly_strncmp(snode->name, name, name_len)) {
+                        break;
+                    }
+                }
+                /* go into the item to a) process it as a key or b) start skipping it as another list child */
+                ret = lyjson_ctx_next(jsonctx, &status);
+                LY_CHECK_GOTO(ret, cleanup);
+
+                if (snode) {
+                    /* we have the key, validate the value */
+                    if (status < LYJSON_NUMBER) {
+                        /* not a terminal */
+                        ret = LY_ENOT;
+                        goto cleanup;
+                    }
+
+                    ret = _lys_value_validate(NULL, snode, jsonctx->value, jsonctx->value_len, lydjson_resolve_prefix, jsonctx, LYD_JSON);
+                    LY_CHECK_GOTO(ret, cleanup);
+
+                    /* key with a valid value, remove from the set */
+                    ly_set_rm_index(&key_set, i, NULL);
+                }
+            } else {
+                /* start skipping the member we are not interested in */
+                ret = lyjson_ctx_next(jsonctx, &status);
+                LY_CHECK_GOTO(ret, cleanup);
+            }
+            /* move to the next child */
+            while (status_count < jsonctx->status.count) {
+                ret = lyjson_ctx_next(jsonctx, &status);
+                LY_CHECK_GOTO(ret, cleanup);
+            }
+        }
+    }
+
+    if (key_set.count) {
+        /* some keys are missing/did not validate */
+        ret = LY_ENOT;
+    }
+
+cleanup:
+    ly_set_erase(&key_set, NULL);
+    return ret;
+}
+
+/**
+ * @brief Get the hint for the data type parsers according to the current JSON parser context.
+ *
+ * @param[in] lydctx JSON data parser context. The context is supposed to be on a value.
+ * @param[in,out] status Pointer to the current context status,
+ * in some circumstances the function manipulates with the context so the status is updated.
+ * @param[out] type_hint_p Pointer to the variable to store the result.
+ * @return LY_SUCCESS in case of success.
+ * @return LY_EINVAL in case of invalid context status not referring to a value.
+ */
+static LY_ERR
+lydjson_value_type_hint(struct lyd_json_ctx *lydctx, enum LYJSON_PARSER_STATUS *status_p, int *type_hint_p)
+{
+    *type_hint_p = 0;
+
+    if (*status_p == LYJSON_ARRAY) {
+        /* only [null] */
+        LY_CHECK_RET(lyjson_ctx_next(lydctx->jsonctx, status_p));
+        LY_CHECK_RET(*status_p != LYJSON_NULL, LY_EINVAL);
+
+        LY_CHECK_RET(lyjson_ctx_next(lydctx->jsonctx, NULL));
+        LY_CHECK_RET(lyjson_ctx_status(lydctx->jsonctx, 0) != LYJSON_ARRAY_CLOSED, LY_EINVAL);
+
+        *type_hint_p = LYD_NODE_OPAQ_ISEMPTY;
+    } else if (*status_p == LYJSON_STRING) {
+        *type_hint_p = LYD_NODE_OPAQ_ISSTRING;
+    } else if (*status_p == LYJSON_NUMBER) {
+        *type_hint_p = LYD_NODE_OPAQ_ISNUMBER;
+    } else if (*status_p == LYJSON_FALSE || *status_p == LYJSON_TRUE) {
+        *type_hint_p = LYD_NODE_OPAQ_ISBOOLEAN;
+    } else if (*status_p == LYJSON_NULL) {
+        *type_hint_p = 0;
+    } else {
+        return LY_EINVAL;
+    }
+
+    return LY_SUCCESS;
+}
+
+/**
+ * @brief Check in advance if the input data are parsable according to the provided @p snode.
+ *
+ * Note that the checks are done only in case the LYD_PARSE_OPAQ is allowed. Otherwise the same checking
+ * is naturally done when the data are really parsed.
+ *
+ * @param[in] lydctx JSON data parser context. When the function returns, the context is in the same state
+ * as before calling, despite it is necessary to process input data for checking.
+ * @param[in] snode Schema node corresponding to the member currently being processed in the context.
+ * @param[out] type_hint_p Pointer to a variable to store detected value type hint in case of leaf or leaf-list.
+ * @return LY_SUCCESS in case the data are ok for the @p snode or the LYD_PARSE_OPAQ is not enabled.
+ * @return LY_ENOT in case the input data are not sufficient to fully parse the list instance
+ * @return LY_EINVAL in case of invalid leaf JSON encoding
+ * and they are expected to be parsed as opaq nodes.
+ */
+static LY_ERR
+lydjson_data_check_opaq(struct lyd_json_ctx *lydctx, const struct lysc_node *snode, int *type_hint_p)
+{
+    LY_ERR ret = LY_SUCCESS;
+    struct lyjson_ctx *jsonctx = lydctx->jsonctx;
+    enum LYJSON_PARSER_STATUS status;
+
+    assert(snode);
+    assert(snode->nodetype & (LYD_NODE_TERM | LYS_LIST));
+
+    if ((lydctx->parse_options & LYD_PARSE_OPAQ)) {
+        /* backup parser */
+        lyjson_ctx_backup(jsonctx);
+        status = lyjson_ctx_status(jsonctx, 0);
+
+        /* check if the node is parseable. if not, NULL the snode to announce that it is supposed to be parsed as an opaq node */
+        switch (snode->nodetype) {
+        case LYS_LEAFLIST:
+        case LYS_LEAF:
+            /* value may not be valid in which case we parse it as an opaque node */
+            ret = lydjson_value_type_hint(lydctx, &status, type_hint_p);
+            if (ret) {
+                break;
+            }
+
+            if (_lys_value_validate(NULL, snode, jsonctx->value, jsonctx->value_len, lydjson_resolve_prefix, jsonctx, LYD_JSON)) {
+                ret = LY_ENOT;
+            }
+            break;
+        case LYS_LIST:
+            /* lists may not have all its keys */
+            if (lydjson_check_list(jsonctx, snode)) {
+                /* invalid list, parse as opaque if it missing/has invalid some keys */
+                ret = LY_ENOT;
+            }
+        }
+
+        /* restore parser */
+        lyjson_ctx_restore(jsonctx);
+    } else if (snode->nodetype & (LYS_LEAF | LYS_LEAFLIST)) {
+        status = lyjson_ctx_status(jsonctx, 0);
+        ret = lydjson_value_type_hint(lydctx, &status, type_hint_p);
+    }
+
+    return ret;
+}
+
+/**
+ * @brief Join the forward-referencing metadata with their target data nodes.
+ *
+ * Note that JSON encoding for YANG data allows forward-referencing metadata only for leafs/leaf-lists.
+ *
+ * @param[in] lydctx JSON data parser context.
+ * @param[in,out] first_p Pointer to the first sibling node variable (top-level or in a particular parent node)
+ * as a starting point to search for the metadata's target data node
+ * @return LY_SUCCESS on success
+ * @return LY_EVALID in case there are some metadata with unresolved target data node instance
+ */
+static LY_ERR
+lydjson_metadata_finish(struct lyd_json_ctx *lydctx, struct lyd_node **first_p)
+{
+    LY_ERR ret = LY_SUCCESS;
+    struct lyd_node *node, *attr, *next, *start = *first_p, *meta_iter;
+    unsigned int instance = 0;
+    const char *prev = NULL;
+
+    /* finish linking metadata */
+    LY_LIST_FOR_SAFE(*first_p, next, attr) {
+        struct lyd_node_opaq *meta_container = (struct lyd_node_opaq*)attr;
+        unsigned int match = 0;
+        int is_attr;
+        const char *name, *prefix;
+        size_t name_len, prefix_len;
+        const struct lysc_node *snode;
+
+        if (attr->schema || meta_container->name[0] != '@') {
+            /* not an opaq metadata node */
+            continue;
+        }
+
+        if (prev != meta_container->name) {
+            /* metas' names are stored in dictionary, so checking pointers must works */
+            lydict_remove(lydctx->jsonctx->ctx, prev);
+            prev = lydict_insert(lydctx->jsonctx->ctx, meta_container->name, 0);
+            instance = 1;
+        } else {
+            instance++;
+        }
+
+        /* find the correspnding data node */
+        LY_LIST_FOR(start, node) {
+            if (!node->schema) {
+                /* opaq node - we are going to put into it just a generic attribute. */
+                if (strcmp(&meta_container->name[1], ((struct lyd_node_opaq*)node)->name)) {
+                    continue;
+                }
+
+                if (((struct lyd_node_opaq*)node)->hint & LYD_NODE_OPAQ_ISLIST) {
+                    LOGVAL(lydctx->jsonctx->ctx, LY_VLOG_LYD, node, LYVE_SYNTAX,
+                           "Metadata container references a sibling list node %s.", ((struct lyd_node_opaq*)node)->name);
+                    ret = LY_EVALID;
+                    goto cleanup;
+                }
+
+                /* match */
+                match++;
+                if (match != instance) {
+                    continue;
+                }
+
+                LY_LIST_FOR(meta_container->child, meta_iter) {
+                    /* convert opaq node to a attribute of the opaq node */
+                    struct lyd_node_opaq *meta = (struct lyd_node_opaq*)meta_iter;
+                    struct ly_prefix *val_prefs = NULL;
+                    int dynamic = 0;
+
+                    /* get value prefixes */
+                    LY_CHECK_GOTO(ret = lydjson_get_value_prefixes(lydctx->jsonctx->ctx, lydctx->jsonctx->value, lydctx->jsonctx->value_len, &val_prefs), cleanup);
+
+                    ret = lyd_create_attr(node, NULL, lydctx->jsonctx->ctx, meta->name, strlen(meta->name), meta->value, ly_strlen(meta->value),
+                                          &dynamic, meta->hint, LYD_JSON, val_prefs, meta->prefix.id, ly_strlen(meta->prefix.id),
+                                          meta->prefix.module_name, ly_strlen(meta->prefix.module_name));
+                    LY_CHECK_GOTO(ret, cleanup);
+                }
+
+                /* done */
+                break;
+            } else {
+                /* this is the second time we are resolving the schema node, so it must succeed,
+                 * but remember that snode can be still NULL */
+                lydjson_parse_name(meta_container->name, strlen(meta_container->name), &name, &name_len, &prefix, &prefix_len, &is_attr);
+                assert(is_attr);
+                ret = lydjson_get_snode(lydctx, is_attr, prefix, prefix_len, name, name_len, (*first_p)->parent, &snode);
+                assert(ret == LY_SUCCESS);
+
+                if (snode != node->schema) {
+                    continue;
+                }
+
+                /* match */
+                match++;
+                if (match != instance) {
+                    continue;
+                }
+
+                LY_LIST_FOR(meta_container->child, meta_iter) {
+                    /* convert opaq node to a metadata of the node */
+                    struct lyd_node_opaq *meta = (struct lyd_node_opaq*)meta_iter;
+                    struct lys_module *mod = NULL;
+                    int dynamic = 0;
+
+                    mod = ly_ctx_get_module_implemented(lydctx->jsonctx->ctx, meta->prefix.id);
+                    if (mod) {
+                        ret = lyd_parser_create_meta((struct lyd_ctx*)lydctx, node, NULL, mod,
+                                                     meta->name, strlen(meta->name), meta->value, ly_strlen(meta->value),
+                                                     &dynamic, meta->hint, lydjson_resolve_prefix, NULL, LYD_JSON, snode);
+                        LY_CHECK_GOTO(ret, cleanup);
+                    } else if (lydctx->parse_options & LYD_PARSE_STRICT) {
+                        LOGVAL(lydctx->jsonctx->ctx, LY_VLOG_LYD, node, LYVE_REFERENCE,
+                               "Unknown (or not implemented) YANG module \"%s\" for metadata \"%s%s%s\".",
+                               meta->prefix.id, meta->prefix.id, ly_strlen(meta->prefix.id) ? ":" : "", meta->name);
+                        ret = LY_EVALID;
+                        goto cleanup;
+                    }
+                }
+                /* add/correct flags */
+                lyd_parse_set_data_flags(node, &lydctx->when_check, &node->meta, lydctx->parse_options);
+
+                /* done */
+                break;
+            }
+        }
+
+        if (match != instance) {
+            /* there is no corresponding data node for the metadata */
+            if (instance > 1) {
+                LOGVAL(lydctx->jsonctx->ctx, LY_VLOG_LYD, *first_p ? (*first_p)->parent : NULL, LYVE_REFERENCE,
+                       "Missing %d%s JSON data instance to be coupled with %s metadata.", instance,
+                       instance == 2 ? "nd" : (instance == 3 ? "rd" : "th"), meta_container->name);
+            } else {
+                LOGVAL(lydctx->jsonctx->ctx, LY_VLOG_LYD, *first_p ? (*first_p)->parent : NULL, LYVE_REFERENCE,
+                       "Missing JSON data instance to be coupled with %s metadata.", meta_container->name);
+            }
+            ret = LY_EVALID;
+        } else {
+            /* remove the opaq attr */
+            if (attr == (*first_p)) {
+                *first_p = attr->next;
+            }
+            lyd_free_tree(attr);
+        }
+    }
+
+cleanup:
+    lydict_remove(lydctx->jsonctx->ctx, prev);
+
+    return ret;
+}
+
+/**
+ * @brief Parse a metadata member.
+ *
+ * @param[in] lydctx JSON data parser context.
+ * @param[in] snode Schema node of the metadata parent.
+ * @param[in] node Parent node in case the metadata is not forward-referencing (only LYD_NODE_TERM)
+ * so the data node does not exists. In such a case the metadata is stored in the context for the later
+ * processing by lydjson_metadata_finish().
+ * @return LY_SUCCESS on success
+ * @return Various LY_ERR values in case of failure.
+ */
+static LY_ERR
+lydjson_metadata(struct lyd_json_ctx *lydctx, const struct lysc_node *snode, struct lyd_node *node)
+{
+    LY_ERR ret = LY_SUCCESS;
+    enum LYJSON_PARSER_STATUS status;
+    const char *expected;
+    int in_parent = 0;
+    const char *name, *prefix = NULL;
+    size_t name_len, prefix_len = 0;
+    struct lys_module *mod;
+    struct lyd_meta *meta = NULL;
+    const struct ly_ctx *ctx = lydctx->jsonctx->ctx;
+    int is_attr = 0;
+    struct lyd_node *prev = node;
+    int instance = 0;
+    uint16_t nodetype;
+
+    assert(snode || node);
+
+    nodetype = snode ? snode->nodetype : LYS_CONTAINER;
+
+    /* move to the second item in the name/X pair */
+    ret = lyjson_ctx_next(lydctx->jsonctx, &status);
+    LY_CHECK_GOTO(ret, cleanup);
+
+    /* check attribute encoding */
+    switch (nodetype) {
+    case LYS_LEAFLIST:
+        expected = "@name/array of objects/nulls";
+
+        LY_CHECK_GOTO(status != LYJSON_ARRAY, representation_error);
+
+next_entry:
+        instance++;
+
+        /* 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);
+            goto cleanup;
+        }
+        LY_CHECK_GOTO(status != LYJSON_OBJECT && status != LYJSON_NULL, representation_error);
+
+        if (!node || node->schema != prev->schema) {
+            LOGVAL(lydctx->jsonctx->ctx, LY_VLOG_LYD, prev->parent, LYVE_REFERENCE,
+                   "Missing JSON data instance no. %d of %s:%s to be coupled with metadata.",
+                   instance, prev->schema->module->name, prev->schema->name);
+            ret = LY_EVALID;
+            goto cleanup;
+        }
+
+        if (status == LYJSON_NULL) {
+            /* continue with the next entry in the leaf-list array */
+            prev = node;
+            node = node->next;
+            goto next_entry;
+        }
+        break;
+    case LYS_LEAF:
+    case LYS_ANYXML:
+        expected = "@name/object";
+
+        LY_CHECK_GOTO(status != LYJSON_OBJECT && (nodetype != LYS_LEAFLIST || status != LYJSON_NULL), representation_error);
+        break;
+    case LYS_CONTAINER:
+    case LYS_LIST:
+    case LYS_ANYDATA:
+    case LYS_NOTIF:
+    case LYS_ACTION:
+    case LYS_RPC:
+        in_parent = 1;
+        expected = "@/object";
+        LY_CHECK_GOTO(status != LYJSON_OBJECT, representation_error);
+        break;
+    }
+
+    /* process all the members inside a single metadata object */
+    assert(status == LYJSON_OBJECT);
+
+    while (status != LYJSON_OBJECT_CLOSED) {
+        lydjson_parse_name(lydctx->jsonctx->value, lydctx->jsonctx->value_len, &name, &name_len, &prefix, &prefix_len, &is_attr);
+        if (!prefix) {
+            LOGVAL(ctx, LY_VLOG_LYD, (void*)node, LYVE_SYNTAX_JSON,
+                   "Metadata in JSON must be namespace-qualified, missing prefix for \"%.*s\".",
+                   lydctx->jsonctx->value_len, lydctx->jsonctx->value);
+            ret = LY_EVALID;
+            goto cleanup;
+        } else if (is_attr) {
+            LOGVAL(ctx, LY_VLOG_LYD, (void*)node, LYVE_SYNTAX_JSON,
+                   "Invalid format of the Metadata identifier in JSON, unexpected '@' in \"%.*s\"",
+                   lydctx->jsonctx->value_len, lydctx->jsonctx->value);
+            ret = LY_EVALID;
+            goto cleanup;
+        }
+
+        /* get the element module */
+        mod = ly_ctx_get_module_implemented2(ctx, prefix, prefix_len);
+        if (!mod) {
+            if (lydctx->parse_options & LYD_PARSE_STRICT) {
+                LOGVAL(ctx, LY_VLOG_LYD, (void*)node, LYVE_REFERENCE,
+                       "Prefix \"%.*s\" of the metadata \"%.*s\" does not match any module in the context.",
+                       prefix_len, prefix, name_len, name);
+                ret = LY_EVALID;
+                goto cleanup;
+            }
+            if (!(lydctx->parse_options & LYD_PARSE_OPAQ)) {
+                /* skip element with children */
+                ret = lydjson_data_skip(lydctx->jsonctx);
+                LY_CHECK_GOTO(ret, cleanup);
+                status = lyjson_ctx_status(lydctx->jsonctx, 0);
+                /* end of the item */
+                continue;
+            }
+        }
+
+        /* get the value */
+        ret = lyjson_ctx_next(lydctx->jsonctx, NULL);
+        LY_CHECK_GOTO(ret, cleanup);
+
+        if (node->schema) {
+            /* create metadata */
+            meta = NULL;
+            ret = lyd_parser_create_meta((struct lyd_ctx*)lydctx, node, &meta, mod, name, name_len, lydctx->jsonctx->value, lydctx->jsonctx->value_len,
+                                         &lydctx->jsonctx->dynamic, 0, lydjson_resolve_prefix, lydctx->jsonctx, LYD_JSON, snode);
+            LY_CHECK_GOTO(ret, cleanup);
+
+            /* add/correct flags */
+            lyd_parse_set_data_flags(node, &lydctx->when_check, &meta, lydctx->parse_options);
+        } else {
+            /* create attribute */
+            struct ly_prefix *val_prefs = NULL;
+            const char *module_name;
+            size_t module_name_len;
+
+            lydjson_get_node_prefix(node, prefix, prefix_len, &module_name, &module_name_len);
+
+            /* get value prefixes */
+            LY_CHECK_GOTO(ret = lydjson_get_value_prefixes(lydctx->jsonctx->ctx, lydctx->jsonctx->value, lydctx->jsonctx->value_len, &val_prefs), cleanup);
+
+            /* attr2 is always changed to the created attribute */
+            ret = lyd_create_attr(node, NULL, lydctx->jsonctx->ctx, name, name_len, lydctx->jsonctx->value, lydctx->jsonctx->value_len,
+                                  &lydctx->jsonctx->dynamic, 0, LYD_JSON, val_prefs, prefix, prefix_len, module_name, module_name_len);
+            LY_CHECK_GOTO(ret, cleanup);
+        }
+        /* next member */
+        ret = lyjson_ctx_next(lydctx->jsonctx, &status);
+        LY_CHECK_GOTO(ret, cleanup);
+    }
+
+    if (nodetype == LYS_LEAFLIST) {
+        /* continue by processing another metadata object for the following
+         * leaf-list instance since they are allways instantiated in JSON array */
+        prev = node;
+        node = node->next;
+        goto next_entry;
+    }
+
+    /* move after the metadata */
+    ret = lyjson_ctx_next(lydctx->jsonctx, NULL);
+    LY_CHECK_GOTO(ret, cleanup);
+
+cleanup:
+    return ret;
+
+representation_error:
+    LOGVAL(ctx, LY_VLOG_LYD, (void*)node, LYVE_SYNTAX_JSON,
+           "The attribute(s) of %s \"%s\" is expected to be represented as JSON %s, but input data contains @%s/%s.",
+           lys_nodetype2str(nodetype), node->schema ? node->schema->name : ((struct lyd_node_opaq*)node)->name,
+           expected, lyjson_token2str(status), in_parent ? "" : "name");
+
+    return LY_EVALID;
+}
+
+/**
+ * @brief Eat the node pointed by @p node_p by inserting it into @p parent and maintain the @p first_p pointing to the first child node.
+ *
+ * @param[in] parent Parent node to insert to, can be NULL in case of top-level (or provided first_p).
+ * @param[in, out] first_p Pointer to the first sibling node in case of top-level.
+ * @param[in, out] node_p pointer to the new node to insert, after the insert is done, pointer is set to NULL.
+ */
+static void
+lydjson_maintain_children(struct lyd_node_inner *parent, struct lyd_node **first_p, struct lyd_node **node_p)
+{
+    if (*node_p) {
+        /* insert, keep first pointer correct */
+        lyd_insert_node((struct lyd_node *)parent, first_p, *node_p);
+        if (first_p) {
+            if (parent) {
+                *first_p = parent->child;
+            } else {
+                while ((*first_p)->prev->next) {
+                    *first_p = (*first_p)->prev;
+                }
+            }
+        }
+        *node_p = NULL;
+    }
+}
+
+static LY_ERR lydjson_subtree_r(struct lyd_json_ctx *lydctx, struct lyd_node_inner *parent, struct lyd_node **first_p);
+
+/**
+ * @brief Parse opaq node from the input.
+ *
+ * In case of processing array, the whole array is being processed and the resulting @p node_p is the last item of the array.
+ *
+ * @param[in] lydctx JSON data parser context.
+ * @param[in] name Name of the opaq node to create.
+ * @param[in] name_len Length of the @p name string.
+ * @param[in] prefix Prefix of the opaq node to create.
+ * @param[in] prefix_len Length of the @p prefx string.
+ * @param[in] parent Data parent of the opaq node to create, can be NULL in case of top level,
+ * but must be set if @p first is not.
+ * @param[in,out] status_p Pointer to the current status of the parser context,
+ * since the function manipulates with the context and process the input, the status can be updated.
+ * @param[in,out] status_inner_p In case of processing JSON array, this parameter points to a standalone
+ * context status of the array content. Otherwise, it is supposed to be the same as @p status_p.
+ * @param[in,out] first_p First top-level/parent sibling, must be set if @p parent is not.
+ * @param[out] node_p Pointer to the created opaq node.
+ * @return LY_ERR value.
+ */
+static LY_ERR
+lydjson_parse_opaq(struct lyd_json_ctx *lydctx, const char *name, size_t name_len,
+                   const char *prefix, size_t prefix_len, struct lyd_node_inner *parent,
+                   enum LYJSON_PARSER_STATUS *status_p, enum LYJSON_PARSER_STATUS *status_inner_p,
+                   struct lyd_node **first_p, struct lyd_node **node_p)
+{
+    LY_ERR ret = LY_SUCCESS;
+    const char *value = NULL, *module_name;
+    size_t value_len = 0, module_name_len = 0;
+    struct ly_prefix *val_prefs = NULL;
+    int dynamic = 0;
+    int type_hint = 0;
+
+    if (*status_inner_p != LYJSON_OBJECT && *status_inner_p != LYJSON_OBJECT_EMPTY) {
+        /* prepare for creating opaq node with a value */
+        value = lydctx->jsonctx->value;
+        value_len = lydctx->jsonctx->value_len;
+        dynamic = lydctx->jsonctx->dynamic;
+        lydctx->jsonctx->dynamic = 0;
+
+        LY_CHECK_RET(lydjson_value_type_hint(lydctx, status_inner_p, &type_hint));
+
+        if (value) {
+            /* get value prefixes */
+            LY_CHECK_RET(lydjson_get_value_prefixes(lydctx->jsonctx->ctx, value, value_len, &val_prefs));
+        }
+    }
+
+    /* create node */
+    lydjson_get_node_prefix((struct lyd_node*)parent, prefix, prefix_len, &module_name, &module_name_len);
+    ret = lyd_create_opaq(lydctx->jsonctx->ctx, name, name_len, value, value_len, &dynamic, type_hint,
+                          LYD_JSON, val_prefs, prefix, prefix_len, module_name, module_name_len, node_p);
+    if (dynamic) {
+        free((char*)value);
+        dynamic = 0;
+    }
+    value = NULL;
+    value_len = 0;
+    val_prefs = NULL;
+    LY_CHECK_RET(ret);
+
+    if (*status_p == LYJSON_OBJECT || *status_p == LYJSON_OBJECT_EMPTY) {
+        /* process children */
+        while (*status_p != LYJSON_OBJECT_CLOSED && *status_p != LYJSON_OBJECT_EMPTY) {
+            LY_CHECK_RET(lydjson_subtree_r(lydctx, (struct lyd_node_inner *)(*node_p), lyd_node_children_p(*node_p)));
+            *status_p = lyjson_ctx_status(lydctx->jsonctx, 0);
+        }
+    } else if (*status_p == LYJSON_ARRAY || *status_p == LYJSON_ARRAY_EMPTY) {
+        /* process another instance of the same node */
+        /* but first mark the node to be expected a list or a leaf-list */
+        ((struct lyd_node_opaq*)*node_p)->hint |= LYD_NODE_OPAQ_ISLIST;
+
+        if (*status_inner_p == LYJSON_OBJECT || *status_inner_p == LYJSON_OBJECT_EMPTY) {
+            /* but first process children of the object in the array */
+            while (*status_inner_p != LYJSON_OBJECT_CLOSED && *status_inner_p != LYJSON_OBJECT_EMPTY) {
+                LY_CHECK_RET(lydjson_subtree_r(lydctx, (struct lyd_node_inner *)(*node_p), lyd_node_children_p(*node_p)));
+                *status_inner_p = lyjson_ctx_status(lydctx->jsonctx, 0);
+            }
+        }
+
+        LY_CHECK_RET(lyjson_ctx_next(lydctx->jsonctx, status_inner_p));
+
+        /* continue with the next instance */
+        if (*status_inner_p != LYJSON_ARRAY_CLOSED) {
+            assert(node_p);
+            lydjson_maintain_children(parent, first_p, node_p);
+            return lydjson_parse_opaq(lydctx, name, name_len, prefix, prefix_len, parent, status_p, status_inner_p, first_p, node_p);
+        }
+    }
+
+    /* finish linking metadata */
+    LY_CHECK_RET(lydjson_metadata_finish(lydctx, lyd_node_children_p(*node_p)));
+
+    /* move after the item */
+    return lyjson_ctx_next(lydctx->jsonctx, status_p);
+}
+
+/**
+ * @brief Process the attribute container (starting by @)
+ *
+ * @param[in] lydctx JSON data parser context.
+ * @param[in] attr_node The data node referenced by the attribute container, if already known.
+ * @param[in] snode The schema node of the data node referenced by the attribute container, if known.
+ * @param[in] name Name of the opaq node to create.
+ * @param[in] name_len Length of the @p name string.
+ * @param[in] prefix Prefix of the opaq node to create.
+ * @param[in] prefix_len Length of the @p prefx string.
+ * @param[in] parent Data parent of the opaq node to create, can be NULL in case of top level,
+ * but must be set if @p first is not.
+ * @param[in,out] status_p Pointer to the current status of the parser context,
+ * since the function manipulates with the context and process the input, the status can be updated.
+ * @param[in,out] first_p First top-level/parent sibling, must be set if @p parent is not.
+ * @param[out] node_p Pointer to the created opaq node.
+ * @return LY_ERR value.
+ */
+static LY_ERR
+lydjson_parse_attribute(struct lyd_json_ctx *lydctx, struct lyd_node *attr_node, const struct lysc_node *snode,
+                        const char *name, size_t name_len, const char *prefix, size_t prefix_len,
+                        struct lyd_node_inner *parent, enum LYJSON_PARSER_STATUS *status_p,
+                        struct lyd_node **first_p, struct lyd_node **node_p)
+{
+    LY_ERR ret = LY_SUCCESS;
+    enum LYJSON_PARSER_STATUS status_inner;
+
+    /* parse as an attribute to a node */
+    if (!attr_node && snode) {
+        /* try to find the instance */
+        for (struct lyd_node *iter = *first_p; iter; iter = iter->next) {
+            if (iter->schema == snode) {
+                attr_node = iter;
+                break;
+            }
+        }
+    }
+    if (!attr_node) {
+        /* parse just as an opaq node with the name beginning with @,
+         * later we have to check that it belongs to a standard node
+         * and it is supposed to be converted to a metadata */
+        uint32_t prev_opts;
+
+        /* move into metadata */
+        LY_CHECK_RET(lyjson_ctx_next(lydctx->jsonctx, status_p));
+
+        if (*status_p == LYJSON_ARRAY) {
+            /* move into the array */
+            LY_CHECK_RET(lyjson_ctx_next(lydctx->jsonctx, &status_inner));
+        } else {
+            /* just a flag to pass correct parameters into lydjson_parse_opaq() */
+            status_inner = LYJSON_ERROR;
+        }
+
+        /* backup parser options to parse unknown metadata as opaq nodes and try to resolve them later */
+        prev_opts = lydctx->parse_options;
+        lydctx->parse_options &= ~LYD_PARSE_STRICT;
+        lydctx->parse_options |= LYD_PARSE_OPAQ;
+
+        ret = lydjson_parse_opaq(lydctx, prefix ? prefix - 1 : name - 1, prefix ? prefix_len + name_len + 2 : name_len + 1,
+                                 NULL, 0, parent, status_p, status_inner == LYJSON_ERROR ? status_p : &status_inner, first_p, node_p);
+
+        /* restore the parser options */
+        lydctx->parse_options = prev_opts;
+    } else {
+        ret = lydjson_metadata(lydctx, snode, attr_node);
+    }
+
+    return ret;
+}
+
+/**
+ * @brief Parse JSON subtree.
+ *
+ * @param[in] lydctx JSON data parser context.
+ * @param[in] parent Data parent of the subtree, must be set if @p first is not.
+ * @param[in,out] first_p Pointer to the variable holding the first top-level sibling, must be set if @p parent is not.
+ * @return LY_ERR value.
+ */
+static LY_ERR
+lydjson_subtree_r(struct lyd_json_ctx *lydctx, struct lyd_node_inner *parent, struct lyd_node **first_p)
+{
+    LY_ERR ret = LY_SUCCESS;
+    enum LYJSON_PARSER_STATUS status = lyjson_ctx_status(lydctx->jsonctx, 0);
+    enum LYJSON_PARSER_STATUS status_inner = 0;
+    const char *name, *prefix = NULL;
+    size_t name_len, prefix_len = 0;
+    int is_attr = 0;
+    const struct lysc_node *snode, *snode_backup = NULL;
+    struct lyd_node *node = NULL, *attr_node = NULL, *anchor = NULL;
+    const struct ly_ctx *ctx = lydctx->jsonctx->ctx;
+    const char *expected = NULL;
+    int type_hint = 0;
+    uint32_t prev_opts;
+
+    assert(parent || first_p);
+    assert(status == LYJSON_OBJECT);
+
+    /* process the node name */
+    lydjson_parse_name(lydctx->jsonctx->value, lydctx->jsonctx->value_len, &name, &name_len, &prefix, &prefix_len, &is_attr);
+
+    if (is_attr && !name_len && !prefix_len) {
+        /* parent's attribute without a name - skip schema node detection and get the schema from the parent */
+        if (!parent) {
+            LOGVAL(ctx, LY_VLOG_LYD, NULL, LYVE_SYNTAX_JSON, "Invalid metadata format - \"@\" can be used only inside anydata, container or list entries.");
+            ret = LY_EVALID;
+            goto cleanup;
+        }
+        attr_node = (struct lyd_node*)parent;
+        snode = parent->schema;
+        goto attribute;
+    }
+
+    /* get the schema node */
+    ret = lydjson_get_snode(lydctx, is_attr, prefix, prefix_len, name, name_len, parent, &snode);
+    if (ret == LY_ENOT) {
+        /* skip element with children */
+        ret = lydjson_data_skip(lydctx->jsonctx);
+        LY_CHECK_GOTO(ret, cleanup);
+        status = lyjson_ctx_status(lydctx->jsonctx, 0);
+        /* nothing for now, continue with another call of lydjson_subtree_r() */
+        goto cleanup;
+    }
+    LY_CHECK_GOTO(ret, cleanup);
+
+    if (!snode) {
+        /* parse as an opaq node */
+        assert((lydctx->parse_options & LYD_PARSE_OPAQ) || (lydctx->int_opts));
+
+        /* move to the second item in the name/X pair */
+        ret = lyjson_ctx_next(lydctx->jsonctx, &status);
+        LY_CHECK_GOTO(ret, cleanup);
+
+        if (status == LYJSON_ARRAY) {
+            /* move into the array */
+            ret = lyjson_ctx_next(lydctx->jsonctx, &status_inner);
+            LY_CHECK_GOTO(ret, cleanup);
+        } else {
+            /* just a flag to pass correct parameters into lydjson_parse_opaq() */
+            status_inner = LYJSON_ERROR;
+        }
+
+        ret = lydjson_parse_opaq(lydctx, name, name_len, prefix, prefix_len,
+                                 parent, &status, status_inner == LYJSON_ERROR ? &status : &status_inner, first_p, &node);
+        LY_CHECK_GOTO(ret, cleanup);
+        is_attr = 1;
+    } else if (!is_attr) {
+        /* parse as a standard lyd_node */
+
+        /* move to the second item in the name/X pair */
+        ret = lyjson_ctx_next(lydctx->jsonctx, &status);
+        LY_CHECK_GOTO(ret, cleanup);
+
+        /* first check the expected representation according to the nodetype and then continue with the content */
+        switch (snode->nodetype) {
+        case LYS_LEAFLIST:
+            expected = "name/array of values";
+
+            LY_CHECK_GOTO(status != LYJSON_ARRAY, representation_error);
+
+            /* move into array */
+            ret = lyjson_ctx_next(lydctx->jsonctx, &status);
+            LY_CHECK_GOTO(ret, cleanup);
+
+            /* process the value */
+            goto next_term;
+        case LYS_LEAF:
+            if (status == LYJSON_ARRAY) {
+                expected = "name/[null]";
+            } else {
+                expected = "name/value";
+            }
+
+next_term:
+            ret = lydjson_data_check_opaq(lydctx, snode, &type_hint);
+            if (ret == LY_SUCCESS) {
+                /* create terminal node */
+                ret = lyd_parser_create_term((struct lyd_ctx*)lydctx, snode, lydctx->jsonctx->value, lydctx->jsonctx->value_len,
+                                             &lydctx->jsonctx->dynamic, type_hint, lydjson_resolve_prefix, lydctx->jsonctx, LYD_JSON, &node);
+                LY_CHECK_GOTO(ret, cleanup);
+
+                ret = lyjson_ctx_next(lydctx->jsonctx, &status);
+                LY_CHECK_GOTO(ret, cleanup);
+            } else if (ret == LY_ENOT) {
+                /* parse it again as an opaq node */
+                ret = lydjson_parse_opaq(lydctx, name, name_len, prefix, prefix_len, parent,
+                                         &status, &status, first_p, &node);
+                LY_CHECK_GOTO(ret, cleanup);
+
+                if (snode->nodetype == LYS_LEAFLIST) {
+                    ((struct lyd_node_opaq*)node)->hint |= LYD_NODE_OPAQ_ISLIST;
+                }
+            } else if (ret == LY_EINVAL) {
+                goto representation_error;
+            } else {
+                goto cleanup;
+            }
+
+            if (snode->nodetype == LYS_LEAFLIST) {
+                /* continue with the next instance of the leaf-list */
+                if(status != LYJSON_ARRAY_CLOSED) {
+                    assert(node);
+                    lydjson_maintain_children(parent, first_p, &node);
+                    goto next_term;
+                }
+
+                /* move after the array */
+                ret = lyjson_ctx_next(lydctx->jsonctx, &status);
+                LY_CHECK_GOTO(ret, cleanup);
+            }
+
+            break;
+        case LYS_LIST:
+            expected = "name/array of objects";
+
+            LY_CHECK_GOTO(status != LYJSON_ARRAY, representation_error);
+
+            /* move into array */
+            ret = lyjson_ctx_next(lydctx->jsonctx, &status);
+            LY_CHECK_GOTO(ret, cleanup);
+
+next_list:
+            if (lydjson_data_check_opaq(lydctx, snode, &type_hint)) {
+                snode_backup = snode;
+                snode = NULL;
+                /* parse it again as an opaq node */
+                ret = lydjson_parse_opaq(lydctx, name, name_len, prefix, prefix_len, parent,
+                                         &status, &status, first_p, &node);
+                LY_CHECK_GOTO(ret, cleanup);
+                ((struct lyd_node_opaq*)node)->hint |= LYD_NODE_OPAQ_ISLIST;
+
+                snode = snode_backup;
+                snode_backup = NULL;
+                goto list_loop;
+            }
+            /* process children - no break */
+        case LYS_CONTAINER:
+        case LYS_NOTIF:
+        case LYS_ACTION:
+        case LYS_RPC:
+            if (snode->nodetype != LYS_LIST) {
+                expected = "name/object";
+            }
+
+            LY_CHECK_GOTO(status != LYJSON_OBJECT && status != LYJSON_OBJECT_EMPTY, representation_error);
+
+            /* create inner node */
+            ret = lyd_create_inner(snode, &node);
+            LY_CHECK_GOTO(ret, cleanup);
+
+            /* process children */
+            while (status != LYJSON_OBJECT_CLOSED && status != LYJSON_OBJECT_EMPTY) {
+                ret = lydjson_subtree_r(lydctx, (struct lyd_node_inner *)node, lyd_node_children_p(node));
+                LY_CHECK_GOTO(ret, cleanup);
+                status = lyjson_ctx_status(lydctx->jsonctx, 0);
+            }
+
+            /* finish linking metadata */
+            ret = lydjson_metadata_finish(lydctx, lyd_node_children_p(node));
+            LY_CHECK_GOTO(ret, cleanup);
+
+            if (snode->nodetype == LYS_LIST) {
+                /* check all keys exist */
+                ret = lyd_parse_check_keys(node);
+                LY_CHECK_GOTO(ret, cleanup);
+            }
+
+            if (!(lydctx->parse_options & LYD_PARSE_ONLY)) {
+                /* new node validation, autodelete CANNOT occur, all nodes are new */
+                ret = lyd_validate_new(lyd_node_children_p(node), snode, NULL, NULL);
+                LY_CHECK_GOTO(ret, cleanup);
+
+                /* add any missing default children */
+                ret = lyd_new_implicit_r(node, lyd_node_children_p(node), NULL, NULL, &lydctx->unres_node_type, &lydctx->when_check,
+                                         (lydctx->validate_options & LYD_VALIDATE_NO_STATE) ? LYD_IMPLICIT_NO_STATE : 0, NULL);
+                LY_CHECK_GOTO(ret, cleanup);
+            }
+
+            ret = lyjson_ctx_next(lydctx->jsonctx, &status);
+            LY_CHECK_GOTO(ret, cleanup);
+            if (snode->nodetype == LYS_LIST) {
+list_loop:
+                /* continue with the next instance of the list */
+                if(status != LYJSON_ARRAY_CLOSED) {
+                    assert(node);
+                    lydjson_maintain_children(parent, first_p, &node);
+                    goto next_list;
+                }
+
+                /* move after the array */
+                ret = lyjson_ctx_next(lydctx->jsonctx, &status);
+                LY_CHECK_GOTO(ret, cleanup);
+
+            } else if (snode->nodetype & (LYS_RPC | LYS_ACTION | LYS_NOTIF)) {
+                /* rememeber the RPC/action/notification */
+                lydctx->op_node = node;
+            }
+
+            break;
+        case LYS_ANYDATA:
+        case LYS_ANYXML:
+            expected = "name/object";
+            LY_CHECK_GOTO(status != LYJSON_OBJECT && status != LYJSON_OBJECT_EMPTY, representation_error);
+
+            /* parse any data tree with correct options */
+            /* first backup the current options and then make the parser to process data as opaq nodes */
+            prev_opts = lydctx->parse_options;
+            lydctx->parse_options &= ~LYD_PARSE_STRICT;
+            lydctx->parse_options |= LYD_PARSE_OPAQ;
+
+            /* process the anydata content */
+            while (status != LYJSON_OBJECT_CLOSED && status != LYJSON_OBJECT_EMPTY) {
+                ret = lydjson_subtree_r(lydctx, NULL, &anchor);
+                LY_CHECK_GOTO(ret, cleanup);
+                status = lyjson_ctx_status(lydctx->jsonctx, 0);
+            }
+
+            /* reset parser options */
+            lydctx->parse_options = prev_opts;
+            LY_CHECK_GOTO(ret, cleanup);
+
+            /* finish linking metadata */
+            ret = lydjson_metadata_finish(lydctx, &anchor);
+            LY_CHECK_GOTO(ret, cleanup);
+
+            /* create any node */
+            ret = lyd_create_any(snode, anchor, LYD_ANYDATA_DATATREE, &node);
+            LY_CHECK_GOTO(ret, cleanup);
+
+            break;
+        }
+
+    } else {
+attribute:
+        ret = lydjson_parse_attribute(lydctx, attr_node, snode, name, name_len, prefix, prefix_len, parent, &status, first_p, &node);
+        LY_CHECK_GOTO(ret, cleanup);
+    }
+
+    lydjson_maintain_children(parent, first_p, &node);
+
+cleanup:
+    lyd_free_tree(node);
+    return ret;
+
+representation_error:
+    LOGVAL(ctx, LY_VLOG_LYD, parent, LYVE_SYNTAX_JSON,
+           "The %s \"%s\" is expected to be represented as JSON %s, but input data contains name/%s.",
+           lys_nodetype2str(snode->nodetype), snode->name, expected, lyjson_token2str(status));
+
+    ret = LY_EVALID;
+    goto cleanup;
+}
+
+/**
+ * @brief Common start of JSON parser processing different types of the input data.
+ *
+ * @param[in] ctx libyang context
+ * @param[in] in Input structure.
+ * @param[in] parse_options Options for parser, see @ref dataparseroptions.
+ * @param[in] validate_options Options for the validation phase, see @ref datavalidationoptions.
+ * @param[out] lydctx_p Data parser context to finish validation.
+ * @return LY_ERR value.
+ */
+static LY_ERR
+lyd_parse_json_init(const struct ly_ctx *ctx, struct ly_in *in, int parse_options, int validate_options, struct lyd_json_ctx **lydctx_p)
+{
+    LY_ERR ret = LY_SUCCESS;
+    struct lyd_json_ctx *lydctx;
+    size_t i, line = 1;
+
+    /* starting top-level */
+    for (i = 0; in->current[i] != '\0' && is_jsonws(in->current[i]); i++) {
+        if (in->current[i] == 0x0a) { /* new line */
+            line++;
+        };
+    }
+    if (in->current[i] == '\0') {
+        /* empty data input */
+        return LY_SUCCESS;
+    }
+    if (in->current[i] != '{') {
+        LOGVAL(ctx, LY_VLOG_LINE, &line, LY_VCODE_INSTREXP, LY_VCODE_INSTREXP_len(&in->current[i]), &in->current[i],
+               "a top-level JSON object ('{') holding encoded YANG data");
+        return LY_EVALID;
+    }
+
+    /* init context */
+    lydctx = calloc(1, sizeof *lydctx);
+    LY_CHECK_ERR_RET(!lydctx, LOGMEM(ctx), LY_EMEM);
+    lydctx->parse_options = parse_options;
+    lydctx->validate_options = validate_options;
+    lydctx->free = lyd_json_ctx_free;
+    lydctx->resolve_prefix = lydjson_resolve_prefix;
+
+    LY_CHECK_ERR_RET(ret = lyjson_ctx_new(ctx, in, &lydctx->jsonctx), free(lydctx), ret);
+
+    *lydctx_p = lydctx;
+    return LY_SUCCESS;
+}
+
+LY_ERR
+lyd_parse_json_data(const struct ly_ctx *ctx, struct ly_in *in, int parse_options, int validate_options, struct lyd_node **tree_p, struct lyd_ctx **lydctx_p)
+{
+    LY_ERR ret = LY_SUCCESS;
+    struct lyd_json_ctx *lydctx = NULL;
+    enum LYJSON_PARSER_STATUS status;
+
+    assert(tree_p);
+    *tree_p = NULL;
+
+    ret = lyd_parse_json_init(ctx, in, parse_options, validate_options, &lydctx);
+    LY_CHECK_GOTO(ret || !lydctx, cleanup);
+
+    status = lyjson_ctx_status(lydctx->jsonctx, 0);
+    assert(status == LYJSON_OBJECT);
+
+    /* read subtree(s) */
+    while (lydctx->jsonctx->in->current[0] && status != LYJSON_OBJECT_CLOSED) {
+        ret = lydjson_subtree_r(lydctx, NULL, tree_p);
+        LY_CHECK_GOTO(ret, cleanup);
+
+        status = lyjson_ctx_status(lydctx->jsonctx, 0);
+    }
+
+    /* finish linking metadata */
+    ret = lydjson_metadata_finish(lydctx, tree_p);
+    LY_CHECK_GOTO(ret, cleanup);
+
+cleanup:
+    /* there should be no unresolved types stored */
+    assert(!(parse_options & LYD_PARSE_ONLY) || (!lydctx->unres_node_type.count && !lydctx->unres_meta_type.count
+           && !lydctx->when_check.count));
+
+    if (ret) {
+        lyd_json_ctx_free((struct lyd_ctx *)lydctx);
+        lyd_free_all(*tree_p);
+        *tree_p = NULL;
+    } else {
+        *lydctx_p = (struct lyd_ctx *)lydctx;
+    }
+
+    return ret;
+}
+
+/**
+ * @brief Parse optional JSON envelope around the Notification data, including the eventTime data.
+ *
+ * @param[in] jsonctx JSON parser context
+ * @param[out] envp_p Pointer to the created envelope opaq container.
+ * @return LY_SUCCESS if the envelope present and successfully parsed.
+ * @return LY_ENOT in case there is not the expected envelope.
+ * @return LY_ERR in case of parsing failure.
+ */
+static LY_ERR
+lydjson_notif_envelope(struct lyjson_ctx *jsonctx, struct lyd_node **envp_p)
+{
+    LY_ERR ret = LY_ENOT, r;
+    const char *name, *prefix, *value = NULL;
+    size_t name_len, prefix_len, value_len;
+    int is_attr, dynamic = 0;
+    enum LYJSON_PARSER_STATUS status;
+    struct lyd_node *et;
+
+    *envp_p = NULL;
+
+    /* backup the context */
+    lyjson_ctx_backup(jsonctx);
+
+    /* "notification" envelope */
+    lydjson_parse_name(jsonctx->value, jsonctx->value_len, &name, &name_len, &prefix, &prefix_len, &is_attr);
+    LY_CHECK_GOTO(is_attr, cleanup);
+    LY_CHECK_GOTO(prefix_len != 13 || strncmp(prefix, "ietf-restconf", 13), cleanup);
+    LY_CHECK_GOTO(name_len != 12 || strncmp(name, "notification", name_len), cleanup);
+
+    r = lyjson_ctx_next(jsonctx, &status);
+    LY_CHECK_ERR_GOTO(r, ret = r, cleanup);
+    LY_CHECK_GOTO(status != LYJSON_OBJECT, cleanup);
+
+    /* "eventTime" child */
+    lydjson_parse_name(jsonctx->value, jsonctx->value_len, &name, &name_len, &prefix, &prefix_len, &is_attr);
+    LY_CHECK_GOTO(prefix_len || is_attr, cleanup);
+    LY_CHECK_GOTO(name_len != 9 || strncmp(name, "eventTime", name_len), cleanup);
+
+    /* go for the data */
+    r = lyjson_ctx_next(jsonctx, &status);
+    LY_CHECK_ERR_GOTO(r, ret = r, cleanup);
+    LY_CHECK_GOTO(status != LYJSON_STRING, cleanup);
+
+    value = jsonctx->value;
+    value_len = jsonctx->value_len;
+    dynamic = jsonctx->dynamic;
+    jsonctx->dynamic = 0;
+
+    r = lyjson_ctx_next(jsonctx, &status);
+    LY_CHECK_ERR_GOTO(r, ret = r, cleanup);
+    LY_CHECK_GOTO(status != LYJSON_OBJECT, cleanup);
+    /* now the notificationContent is expected, which will be parsed by the caller */
+
+    /* create notification envelope */
+    ret = lyd_create_opaq(jsonctx->ctx, "notification", 12, "", 0, NULL, LYD_NODE_OPAQ_ISENVELOPE,
+                          LYD_JSON, NULL, NULL, 0, "ietf-restconf", 13, envp_p);
+    LY_CHECK_GOTO(ret, cleanup);
+    /* create notification envelope */
+    ret = lyd_create_opaq(jsonctx->ctx, "eventTime", 9, value, value_len, &dynamic, LYD_NODE_OPAQ_ISSTRING,
+                          LYD_JSON, NULL, NULL, 0, "ietf-restconf", 13, &et);
+    LY_CHECK_GOTO(ret, cleanup);
+    /* insert eventTime into notification */
+    lyd_insert_node(*envp_p, NULL, et);
+
+    ret = LY_SUCCESS;
+cleanup:
+    if (ret) {
+        /* restore the context */
+        lyjson_ctx_restore(jsonctx);
+        if (dynamic) {
+            free((char*)value);
+        }
+    }
+    return ret;
+}
+
+LY_ERR
+lyd_parse_json_notif(const struct ly_ctx *ctx, struct ly_in *in, struct lyd_node **tree_p, struct lyd_node **ntf_p)
+{
+    LY_ERR ret = LY_SUCCESS;
+    struct lyd_json_ctx *lydctx = NULL;
+    struct lyd_node *ntf_e = NULL;
+    struct lyd_node *tree = NULL;
+    enum LYJSON_PARSER_STATUS status;
+
+    /* init */
+    ret = lyd_parse_json_init(ctx, in, LYD_PARSE_ONLY | LYD_PARSE_STRICT, 0, &lydctx);
+    LY_CHECK_GOTO(ret || !lydctx, cleanup);
+    lydctx->int_opts = LYD_INTOPT_NOTIF;
+
+    status = lyjson_ctx_status(lydctx->jsonctx, 0);
+    assert(status == LYJSON_OBJECT);
+
+    /* parse "notification" and "eventTime", if present */
+    ret = lydjson_notif_envelope(lydctx->jsonctx, &ntf_e);
+    if (ret == LY_ENOT) {
+        ret = LY_SUCCESS;
+    } else if (ret) {
+        goto cleanup;
+    }
+
+    /* read subtree(s) */
+    while (lydctx->jsonctx->in->current[0] && status != LYJSON_OBJECT_CLOSED) {
+        ret = lydjson_subtree_r(lydctx, NULL, &tree);
+        LY_CHECK_GOTO(ret, cleanup);
+
+        status = lyjson_ctx_status(lydctx->jsonctx, 0);
+    }
+
+    /* finish linking metadata */
+    ret = lydjson_metadata_finish(lydctx, &tree);
+    LY_CHECK_GOTO(ret, cleanup);
+
+    /* make sure we have parsed some notification */
+    if (!lydctx->op_node) {
+        LOGVAL(ctx, LY_VLOG_NONE, NULL, LYVE_DATA, "Missing the \"notification\" node.");
+        ret = LY_EVALID;
+        goto cleanup;
+    }
+
+    if (ntf_e) {
+        /* finish notification envelope */
+        ret = lyjson_ctx_next(lydctx->jsonctx, &status);
+        LY_CHECK_GOTO(ret, cleanup);
+        if (status == LYJSON_END) {
+            LOGVAL(ctx, LY_VLOG_LINE, &lydctx->jsonctx->line, LY_VCODE_EOF);
+            ret = LY_EVALID;
+            goto cleanup;
+        } else if (status != LYJSON_OBJECT_CLOSED) {
+            LOGVAL(ctx, LY_VLOG_LINE, &lydctx->jsonctx->line, LYVE_SYNTAX, "Unexpected sibling member \"%.*s\" of \"notification\".",
+                   lydctx->jsonctx->value_len, lydctx->jsonctx->value);
+            ret = LY_EVALID;
+            goto cleanup;
+        }
+    }
+
+    if (ntf_p) {
+        *ntf_p = lydctx->op_node;
+    }
+    assert(tree);
+    if (tree_p) {
+        *tree_p = tree;
+    }
+    if (ntf_e) {
+        /* connect to the notification */
+        lyd_insert_node(ntf_e, NULL, *tree_p);
+        if (tree_p) {
+            *tree_p = ntf_e;
+        }
+    }
+
+cleanup:
+    /* we have used parse_only flag */
+    assert(!lydctx || (!lydctx->unres_node_type.count && !lydctx->unres_meta_type.count && !lydctx->when_check.count));
+
+    lyd_json_ctx_free((struct lyd_ctx *)lydctx);
+    if (ret) {
+        lyd_free_all(tree);
+        lyd_free_tree(ntf_e);
+    }
+    return ret;
+}
+
+/**
+ * @brief Parse optional JSON envelope around the processed content.
+ *
+ * @param[in] jsonctx JSON parser context
+ * @param[in] parent Parent node (some other envelope).
+ * @param[in] module_key Name of the module where the envelope element is expected.
+ * @param[in] object_id Name of the envelope object.
+ * @param[out] envp_p Pointer to the created envelope opaq container.
+ * @return LY_SUCCESS if the envelope present and successfully parsed.
+ * @return LY_ENOT in case there is not the expected envelope.
+ * @return LY_ERR in case of parsing failure.
+ */
+static LY_ERR
+lydjson_object_envelope(struct lyjson_ctx *jsonctx, struct lyd_node *parent, const char *module_key, const char *object_id, struct lyd_node **envp_p)
+{
+    LY_ERR ret = LY_ENOT, r;
+    const char *name, *prefix;
+    size_t name_len, prefix_len;
+    int is_attr;
+    enum LYJSON_PARSER_STATUS status;
+
+    *envp_p = NULL;
+
+    /* "id" envelope */
+    lydjson_parse_name(jsonctx->value, jsonctx->value_len, &name, &name_len, &prefix, &prefix_len, &is_attr);
+    LY_CHECK_GOTO(is_attr, cleanup);
+    LY_CHECK_GOTO(lydjson_get_node_prefix(parent, prefix, prefix_len, &prefix, &prefix_len), cleanup);
+    LY_CHECK_GOTO(prefix_len != strlen(module_key) || strncmp(prefix, module_key, prefix_len), cleanup);
+    LY_CHECK_GOTO(name_len != strlen(object_id) || strncmp(name, object_id, name_len), cleanup);
+
+    r = lyjson_ctx_next(jsonctx, &status);
+    LY_CHECK_ERR_GOTO(r, ret = r, cleanup);
+    LY_CHECK_GOTO(status != LYJSON_OBJECT, cleanup);
+
+    /* create the object envelope */
+    ret = lyd_create_opaq(jsonctx->ctx, object_id, strlen(object_id), "", 0, NULL,
+                          LYD_NODE_OPAQ_ISENVELOPE, LYD_JSON, NULL, NULL, 0,
+                          module_key, ly_strlen(module_key), envp_p);
+    LY_CHECK_GOTO(ret, cleanup);
+
+    if (parent) {
+        lyd_insert_node(parent, NULL, *envp_p);
+    }
+
+    ret = LY_SUCCESS;
+cleanup:
+    return ret;
+}
+
+static LY_ERR
+lydjson_object_envelope_close(struct lyjson_ctx *jsonctx, const char *object_id)
+{
+    enum LYJSON_PARSER_STATUS status;
+
+    LY_CHECK_RET(lyjson_ctx_next(jsonctx, &status));
+    if (status == LYJSON_END) {
+        LOGVAL(jsonctx->ctx, LY_VLOG_LINE, &jsonctx->line, LY_VCODE_EOF);
+        return LY_EVALID;
+    } else if (status != LYJSON_OBJECT_CLOSED) {
+        LOGVAL(jsonctx->ctx, LY_VLOG_LINE, &jsonctx->line, LYVE_SYNTAX, "Unexpected sibling member \"%.*s\" of \"%s\".",
+               jsonctx->value_len, jsonctx->value, object_id);
+        return LY_EVALID;
+    }
+    return LY_SUCCESS;
+}
+
+LY_ERR
+lyd_parse_json_rpc(const struct ly_ctx *ctx, struct ly_in *in, struct lyd_node **tree_p, struct lyd_node **op_p)
+{
+    LY_ERR ret = LY_SUCCESS;
+    struct lyd_json_ctx *lydctx = NULL;
+    struct lyd_node *rpc_e = NULL, *act_e = NULL;
+    struct lyd_node *tree = NULL;
+    enum LYJSON_PARSER_STATUS status;
+
+    /* init */
+    ret = lyd_parse_json_init(ctx, in, LYD_PARSE_ONLY | LYD_PARSE_STRICT, 0, &lydctx);
+    LY_CHECK_GOTO(ret || !lydctx, cleanup);
+    lydctx->int_opts = LYD_INTOPT_RPC;
+
+    /* process envelope(s), if present */
+
+    /* process rpc */
+    ret = lydjson_object_envelope(lydctx->jsonctx, NULL, "ietf-netconf", "rpc", &rpc_e);
+    if (ret == LY_ENOT) {
+        ret = LY_SUCCESS;
+        goto parse_content;
+    } else if (ret) {
+        goto cleanup;
+    }
+    /* process action */
+    ret = lydjson_object_envelope(lydctx->jsonctx, rpc_e, "yang", "action", &act_e);
+    if (ret == LY_ENOT) {
+        ret = LY_SUCCESS;
+        goto parse_content;
+    } else if (ret) {
+        goto cleanup;
+    }
+
+parse_content:
+
+    status = lyjson_ctx_status(lydctx->jsonctx, 0);
+    assert(status == LYJSON_OBJECT);
+
+    /* read subtree(s) */
+    while (lydctx->jsonctx->in->current[0] && status != LYJSON_OBJECT_CLOSED) {
+        ret = lydjson_subtree_r(lydctx, act_e ? (struct lyd_node_inner*)act_e : (struct lyd_node_inner*)rpc_e, &tree);
+        LY_CHECK_GOTO(ret, cleanup);
+
+        status = lyjson_ctx_status(lydctx->jsonctx, 0);
+    }
+
+    /* finish linking metadata */
+    ret = lydjson_metadata_finish(lydctx, &tree);
+    LY_CHECK_GOTO(ret, cleanup);
+
+    /* make sure we have parsed some operation */
+    if (!lydctx->op_node) {
+        LOGVAL(ctx, LY_VLOG_NONE, NULL, LYVE_DATA, "Missing the %s node.",
+               act_e ? "action" : (rpc_e ? "rpc" : "rpc/action"));
+        ret = LY_EVALID;
+        goto cleanup;
+    }
+
+    if (act_e) {
+        /* finish action envelope */
+        ret = lydjson_object_envelope_close(lydctx->jsonctx, "action");
+        LY_CHECK_GOTO(ret, cleanup);
+        if (lydctx->op_node->schema->nodetype != LYS_ACTION) {
+            LOGVAL(ctx, LY_VLOG_LYD, lydctx->op_node, LYVE_DATA, "Unexpected %s element, an \"action\" expected.",
+                   lys_nodetype2str(lydctx->op_node->schema->nodetype));
+            ret = LY_EVALID;
+            goto cleanup;
+        }
+    }
+    if (rpc_e) {
+        /* finish rpc envelope */
+        ret = lydjson_object_envelope_close(lydctx->jsonctx, "rpc");
+        LY_CHECK_GOTO(ret, cleanup);
+        if (!act_e && lydctx->op_node->schema->nodetype != LYS_RPC) {
+            LOGVAL(ctx, LY_VLOG_LYD, lydctx->op_node, LYVE_DATA, "Unexpected %s element, an \"rpc\" expected.",
+                   lys_nodetype2str(lydctx->op_node->schema->nodetype));
+            ret = LY_EVALID;
+            goto cleanup;
+        }
+    }
+
+    if (op_p) {
+        *op_p = lydctx->op_node;
+    }
+    assert(tree);
+    if (tree_p) {
+        if (rpc_e) {
+            *tree_p = rpc_e;
+        } else if (act_e) {
+            *tree_p = act_e;
+        } else {
+            *tree_p = tree;
+        }
+    }
+
+cleanup:
+    /* we have used parse_only flag */
+    assert(!lydctx || (!lydctx->unres_node_type.count && !lydctx->unres_meta_type.count && !lydctx->when_check.count));
+
+    lyd_json_ctx_free((struct lyd_ctx *)lydctx);
+    if (ret) {
+        lyd_free_all(tree);
+        lyd_free_tree(act_e);
+        lyd_free_tree(rpc_e);
+    }
+    return ret;
+}
+
+LY_ERR
+lyd_parse_json_reply(const struct lyd_node *request, struct ly_in *in, struct lyd_node **tree_p, struct lyd_node **op_p)
+{
+    LY_ERR ret = LY_SUCCESS;
+    struct lyd_json_ctx *lydctx = NULL;
+    struct lyd_node *rpcr_e = NULL, *iter, *req_op, *rep_op = NULL;
+    enum LYJSON_PARSER_STATUS status;
+
+    /* init */
+    ret = lyd_parse_json_init(LYD_NODE_CTX(request), in, LYD_PARSE_ONLY | LYD_PARSE_STRICT, 0, &lydctx);
+    LY_CHECK_GOTO(ret || !lydctx, cleanup);
+    lydctx->int_opts = LYD_INTOPT_REPLY;
+
+    /* find request OP */
+    LYD_TREE_DFS_BEGIN((struct lyd_node *)request, req_op) {
+        if (req_op->schema->nodetype & (LYS_RPC | LYS_ACTION)) {
+            break;
+        }
+        LYD_TREE_DFS_END(request, req_op);
+    }
+    if (!(req_op->schema->nodetype & (LYS_RPC | LYS_ACTION))) {
+        LOGERR(LYD_NODE_CTX(request), LY_EINVAL, "No RPC/action in the request found.");
+        ret = LY_EINVAL;
+        goto cleanup;
+    }
+
+    /* duplicate request OP with parents */
+    LY_CHECK_GOTO(ret = lyd_dup_single(req_op, NULL, LYD_DUP_WITH_PARENTS, &rep_op), cleanup);
+
+    /* parse "rpc-reply", if any */
+    ret = lydjson_object_envelope(lydctx->jsonctx, NULL, "ietf-netconf", "rpc-reply", &rpcr_e);
+    if (ret == LY_ENOT) {
+        ret = LY_SUCCESS;
+    } else if (ret) {
+        goto cleanup;
+    }
+
+    status = lyjson_ctx_status(lydctx->jsonctx, 0);
+    assert(status == LYJSON_OBJECT);
+
+    /* read subtree(s) */
+    while (lydctx->jsonctx->in->current[0] && status != LYJSON_OBJECT_CLOSED) {
+        ret = lydjson_subtree_r(lydctx, (struct lyd_node_inner*)rep_op, lyd_node_children_p(rep_op));
+        LY_CHECK_GOTO(ret, cleanup);
+
+        status = lyjson_ctx_status(lydctx->jsonctx, 0);
+    }
+
+    /* finish linking metadata */
+    ret = lydjson_metadata_finish(lydctx, lyd_node_children_p(rep_op));
+    LY_CHECK_GOTO(ret, cleanup);
+
+    if (rpcr_e) {
+        /* finish rpc-reply envelope */
+        ret = lydjson_object_envelope_close(lydctx->jsonctx, "rpc-reply");
+        LY_CHECK_GOTO(ret, cleanup);
+    }
+
+    if (op_p) {
+        *op_p = rep_op;
+    }
+    for (iter = rep_op; iter->parent; iter = (struct lyd_node *)iter->parent);
+    if (tree_p) {
+        *tree_p = iter;
+    }
+    if (rpcr_e) {
+        /* connect to the operation */
+        lyd_insert_node(rpcr_e, NULL, iter);
+        if (tree_p) {
+            *tree_p = rpcr_e;
+        }
+    }
+
+cleanup:
+    /* we have used parse_only flag */
+    assert(!lydctx || (!lydctx->unres_node_type.count && !lydctx->unres_meta_type.count && !lydctx->when_check.count));
+
+    lyd_json_ctx_free((struct lyd_ctx *)lydctx);
+    if (ret) {
+        lyd_free_all(rep_op);
+        lyd_free_tree(rpcr_e);
+    }
+    return ret;
 }
diff --git a/src/parser_lyb.c b/src/parser_lyb.c
index fc74236..3c8fa76 100644
--- a/src/parser_lyb.c
+++ b/src/parser_lyb.c
@@ -33,6 +33,32 @@
 #include "tree_schema.h"
 #include "validation.h"
 
+void
+lylyb_ctx_free(struct lylyb_ctx *ctx)
+{
+    LY_ARRAY_COUNT_TYPE u;
+
+    LY_ARRAY_FREE(ctx->subtrees);
+    LY_ARRAY_FREE(ctx->models);
+
+    LY_ARRAY_FOR(ctx->sib_hts, u) {
+        lyht_free(ctx->sib_hts[u].ht);
+    }
+    LY_ARRAY_FREE(ctx->sib_hts);
+
+    free(ctx);
+}
+
+void
+lyd_lyb_ctx_free(struct lyd_ctx *lydctx)
+{
+    struct lyd_lyb_ctx *ctx = (struct lyd_lyb_ctx *)lydctx;
+
+    lyd_ctx_free(lydctx);
+    lylyb_ctx_free(ctx->lybctx);
+    free(ctx);
+}
+
 /**
  * @brief Read YANG data from LYB input. Metadata are handled transparently and not returned.
  *
@@ -41,7 +67,7 @@
  * @param[in] lybctx LYB context.
  */
 static void
-lyb_read(uint8_t *buf, size_t count, struct lyd_lyb_ctx *lybctx)
+lyb_read(uint8_t *buf, size_t count, struct lylyb_ctx *lybctx)
 {
     LY_ARRAY_COUNT_TYPE u;
     struct lyd_lyb_subtree *empty;
@@ -109,7 +135,7 @@
  * @param[in] lybctx LYB context.
  */
 static void
-lyb_read_number(void *num, size_t num_size, size_t bytes, struct lyd_lyb_ctx *lybctx)
+lyb_read_number(void *num, size_t num_size, size_t bytes, struct lylyb_ctx *lybctx)
 {
     uint64_t buf = 0;
 
@@ -145,7 +171,7 @@
  * @return LY_ERR value.
  */
 static LY_ERR
-lyb_read_string(char **str, int with_length, struct lyd_lyb_ctx *lybctx)
+lyb_read_string(char **str, int with_length, struct lylyb_ctx *lybctx)
 {
     int next_chunk = 0;
     size_t len = 0, cur_len;
@@ -194,7 +220,7 @@
  * @return LY_ERR value.
  */
 static LY_ERR
-lyb_read_stop_subtree(struct lyd_lyb_ctx *lybctx)
+lyb_read_stop_subtree(struct lylyb_ctx *lybctx)
 {
     if (LYB_LAST_SUBTREE(lybctx).written) {
         LOGINT_RET(lybctx->ctx);
@@ -211,7 +237,7 @@
  * @return LY_ERR value.
  */
 static LY_ERR
-lyb_read_start_subtree(struct lyd_lyb_ctx *lybctx)
+lyb_read_start_subtree(struct lylyb_ctx *lybctx)
 {
     uint8_t meta_buf[LYB_META_BYTES];
     LY_ARRAY_COUNT_TYPE u;
@@ -245,7 +271,7 @@
  * @return LY_ERR value.
  */
 static LY_ERR
-lyb_parse_model(struct lyd_lyb_ctx *lybctx, const struct lys_module **mod)
+lyb_parse_model(struct lylyb_ctx *lybctx, uint32_t parse_options, const struct lys_module **mod)
 {
     LY_ERR ret = LY_SUCCESS;
     char *mod_name = NULL, mod_rev[11];
@@ -267,7 +293,7 @@
     if (rev) {
         sprintf(mod_rev, "%04u-%02u-%02u", ((rev & 0xFE00) >> 9) + 2000, (rev & 0x01E0) >> 5, rev & 0x001Fu);
         *mod = ly_ctx_get_module(lybctx->ctx, mod_name, mod_rev);
-        if ((lybctx->parse_options & LYD_PARSE_LYB_MOD_UPDATE) && !(*mod)) {
+        if ((parse_options & LYD_PARSE_LYB_MOD_UPDATE) && !(*mod)) {
             /* try to use an updated module */
             *mod = ly_ctx_get_module_implemented(lybctx->ctx, mod_name);
             if (*mod && (!(*mod)->revision || (strcmp((*mod)->revision, mod_rev) < 0))) {
@@ -288,7 +314,7 @@
     }*/
 
     if (!*mod || !(*mod)->implemented) {
-        if (lybctx->parse_options & LYD_PARSE_STRICT) {
+        if (parse_options & LYD_PARSE_STRICT) {
             if (!*mod) {
                 LOGERR(lybctx->ctx, LY_EINVAL, "Invalid context for LYB data parsing, missing module \"%s%s%s\".",
                     mod_name, rev ? "@" : "", rev ? mod_rev : "");
@@ -325,37 +351,37 @@
     const struct lys_module *mod;
 
     /* read number of attributes stored */
-    lyb_read(&count, 1, lybctx);
+    lyb_read(&count, 1, lybctx->lybctx);
 
     /* read attributes */
     for (i = 0; i < count; ++i) {
-        ret = lyb_read_start_subtree(lybctx);
+        ret = lyb_read_start_subtree(lybctx->lybctx);
         LY_CHECK_GOTO(ret, cleanup);
 
         /* find model */
-        ret = lyb_parse_model(lybctx, &mod);
+        ret = lyb_parse_model(lybctx->lybctx, lybctx->parse_options, &mod);
         LY_CHECK_GOTO(ret, cleanup);
 
         if (!mod) {
             /* skip it */
             do {
-                lyb_read(NULL, LYB_LAST_SUBTREE(lybctx).written, lybctx);
-            } while (LYB_LAST_SUBTREE(lybctx).written);
+                lyb_read(NULL, LYB_LAST_SUBTREE(lybctx->lybctx).written, lybctx->lybctx);
+            } while (LYB_LAST_SUBTREE(lybctx->lybctx).written);
             goto stop_subtree;
         }
 
         /* meta name */
-        ret = lyb_read_string(&meta_name, 1, lybctx);
+        ret = lyb_read_string(&meta_name, 1, lybctx->lybctx);
         LY_CHECK_GOTO(ret, cleanup);
 
         /* meta value */
-        ret = lyb_read_string(&meta_value, 0, lybctx);
+        ret = lyb_read_string(&meta_value, 0, lybctx->lybctx);
         LY_CHECK_GOTO(ret, cleanup);
         dynamic = 1;
 
         /* create metadata */
-        ret = lyd_create_meta(NULL, meta, mod, meta_name, strlen(meta_name), meta_value, strlen(meta_value), &dynamic,
-                              lydjson_resolve_prefix, NULL, LYD_JSON, sparent);
+        ret = lyd_parser_create_meta((struct lyd_ctx*)lybctx, NULL, meta, mod, meta_name, strlen(meta_name), meta_value, ly_strlen(meta_value),
+                                     &dynamic, 0, lydjson_resolve_prefix, NULL, LYD_JSON, sparent);
 
         /* free strings */
         free(meta_name);
@@ -365,14 +391,10 @@
             dynamic = 0;
         }
 
-        if (ret == LY_EINCOMPLETE) {
-            ly_set_add(&lybctx->unres_meta_type, *meta, LY_SET_OPT_USEASLIST);
-        } else if (ret) {
-            goto cleanup;
-        }
+        LY_CHECK_GOTO(ret, cleanup);
 
 stop_subtree:
-        ret = lyb_read_stop_subtree(lybctx);
+        ret = lyb_read_stop_subtree(lybctx->lybctx);
         LY_CHECK_GOTO(ret, cleanup);
     }
 
@@ -393,7 +415,7 @@
  * @return LY_ERR value.
  */
 static LY_ERR
-lyb_parse_opaq_prefixes(struct lyd_lyb_ctx *lybctx, struct ly_prefix **prefs)
+lyb_parse_opaq_prefixes(struct lylyb_ctx *lybctx, struct ly_prefix **prefs)
 {
     LY_ERR ret = LY_SUCCESS;
     uint8_t count, i;
@@ -412,12 +434,12 @@
         /* prefix */
         ret = lyb_read_string(&str, 1, lybctx);
         LY_CHECK_GOTO(ret, cleanup);
-        (*prefs)[i].pref = lydict_insert_zc(lybctx->ctx, str);
+        (*prefs)[i].id = lydict_insert_zc(lybctx->ctx, str);
 
-        /* namespace */
+        /* module reference is the same as JSON name */
         ret = lyb_read_string(&str, 1, lybctx);
         LY_CHECK_GOTO(ret, cleanup);
-        (*prefs)[i].ns = lydict_insert_zc(lybctx->ctx, str);
+        (*prefs)[i].module_name = lydict_insert_zc(lybctx->ctx, str);
     }
 
 cleanup:
@@ -436,12 +458,12 @@
  * @return LY_ERR value.
  */
 static LY_ERR
-lyb_parse_attributes(struct lyd_lyb_ctx *lybctx, struct ly_attr **attr)
+lyb_parse_attributes(struct lylyb_ctx *lybctx, struct lyd_attr **attr)
 {
     LY_ERR ret = LY_SUCCESS;
     uint8_t count, i;
-    struct ly_attr *attr2;
-    char *prefix = NULL, *ns = NULL, *name = NULL, *value = NULL;
+    struct lyd_attr *attr2;
+    char *prefix = NULL, *module_name = NULL, *name = NULL, *value = NULL;
     int dynamic = 0;
     LYD_FORMAT format = 0;
     struct ly_prefix *val_prefs = NULL;
@@ -463,11 +485,11 @@
         }
 
         /* namespace, may be empty */
-        ret = lyb_read_string(&ns, 1, lybctx);
+        ret = lyb_read_string(&module_name, 1, lybctx);
         LY_CHECK_GOTO(ret, cleanup);
-        if (!ns[0]) {
-            free(ns);
-            ns = NULL;
+        if (!module_name[0]) {
+            free(module_name);
+            module_name = NULL;
         }
 
         /* name */
@@ -487,14 +509,14 @@
         dynamic = 1;
 
         /* attr2 is always changed to the created attribute */
-        ret = ly_create_attr(NULL, &attr2, lybctx->ctx, name, strlen(name), value, strlen(value), &dynamic, format,
-                             val_prefs, prefix, prefix ? strlen(prefix) : 0, ns);
+        ret = lyd_create_attr(NULL, &attr2, lybctx->ctx, name, strlen(name), value, ly_strlen(value), &dynamic, 0, format,
+                              val_prefs, prefix, ly_strlen(prefix), module_name, ly_strlen(module_name));
         LY_CHECK_GOTO(ret, cleanup);
 
         free(prefix);
         prefix = NULL;
-        free(ns);
-        ns = NULL;
+        free(module_name);
+        module_name = NULL;
         free(name);
         name = NULL;
         val_prefs = NULL;
@@ -511,7 +533,7 @@
 
 cleanup:
     free(prefix);
-    free(ns);
+    free(module_name);
     free(name);
     if (dynamic) {
         free(value);
@@ -551,54 +573,6 @@
 }
 
 /**
- * @brief Check that a schema node is suitable based on options.
- *
- * @param[in] lybctx LYB context.
- * @param[in] snode Schema node to check.
- * @return LY_ERR value.
- */
-static LY_ERR
-lyb_parse_check_schema(struct lyd_lyb_ctx *lybctx, const struct lysc_node *snode)
-{
-    LY_ERR ret = LY_SUCCESS;
-
-    if ((lybctx->parse_options & LYD_PARSE_NO_STATE) && (snode->flags & LYS_CONFIG_R)) {
-        LOGVAL(lybctx->ctx, LY_VLOG_LYSC, snode, LY_VCODE_INNODE, "state", snode->name);
-        return LY_EVALID;
-    }
-
-    if (snode->nodetype & (LYS_RPC | LYS_ACTION)) {
-        if (lybctx->int_opts & LYD_INTOPT_RPC) {
-            if (lybctx->op_ntf) {
-                LOGVAL(lybctx->ctx, LY_VLOG_LYSC, snode, LYVE_DATA, "Unexpected %s element \"%s\", %s \"%s\" already parsed.",
-                       lys_nodetype2str(snode->nodetype), snode->name,
-                       lys_nodetype2str(lybctx->op_ntf->schema->nodetype), lybctx->op_ntf->schema->name);
-                return LY_EVALID;
-            }
-        } else {
-            LOGVAL(lybctx->ctx, LY_VLOG_LYSC, snode, LYVE_DATA, "Unexpected %s element \"%s\".",
-                   lys_nodetype2str(snode->nodetype), snode->name);
-            return LY_EVALID;
-        }
-    } else if (snode->nodetype == LYS_NOTIF) {
-        if (lybctx->int_opts & LYD_INTOPT_NOTIF) {
-            if (lybctx->op_ntf) {
-                LOGVAL(lybctx->ctx, LY_VLOG_LYSC, snode, LYVE_DATA, "Unexpected %s element \"%s\", %s \"%s\" already parsed.",
-                       lys_nodetype2str(snode->nodetype), snode->name,
-                       lys_nodetype2str(lybctx->op_ntf->schema->nodetype), lybctx->op_ntf->schema->name);
-                return LY_EVALID;
-            }
-        } else {
-            LOGVAL(lybctx->ctx, LY_VLOG_LYSC, snode, LYVE_DATA, "Unexpected %s element \"%s\".",
-                   lys_nodetype2str(snode->nodetype), snode->name);
-            return LY_EVALID;
-        }
-    }
-
-    return ret;
-}
-
-/**
  * @brief Parse schema node hash.
  *
  * @param[in] lybctx LYB context.
@@ -622,7 +596,7 @@
     getnext_opts = LYS_GETNEXT_NOSTATECHECK | (lybctx->int_opts & LYD_INTOPT_REPLY ? LYS_GETNEXT_OUTPUT : 0);
 
     /* read the first hash */
-    lyb_read(&hash[0], sizeof *hash, lybctx);
+    lyb_read(&hash[0], sizeof *hash, lybctx->lybctx);
 
     if (!hash[0]) {
         /* opaque node */
@@ -632,7 +606,7 @@
     /* based on the first hash read all the other ones, if any */
     for (i = 0; !(hash[0] & (LYB_HASH_COLLISION_ID >> i)); ++i) {
         if (i > LYB_HASH_BITS) {
-            LOGINT_RET(lybctx->ctx);
+            LOGINT_RET(lybctx->lybctx->ctx);
         }
     }
 
@@ -641,7 +615,7 @@
 
     /* read the rest of hashes */
     for (j = i; j; --j) {
-        lyb_read(&hash[j - 1], sizeof *hash, lybctx);
+        lyb_read(&hash[j - 1], sizeof *hash, lybctx->lybctx);
 
         /* correct collision ID */
         assert(hash[j - 1] & (LYB_HASH_COLLISION_ID >> (j - 1)));
@@ -653,7 +627,7 @@
     sibling = NULL;
     while ((sibling = lys_getnext(sibling, sparent, mod ? mod->compiled : NULL, getnext_opts))) {
         /* skip schema nodes from models not present during printing */
-        if (lyb_has_schema_model(sibling, lybctx->models)
+        if (lyb_has_schema_model(sibling, lybctx->lybctx->models)
                 && lyb_is_schema_hash_match((struct lysc_node *)sibling, hash, i + 1)) {
             /* match found */
             break;
@@ -662,14 +636,14 @@
 
     if (!sibling && (lybctx->parse_options & LYD_PARSE_STRICT)) {
         if (mod) {
-            LOGVAL(lybctx->ctx, LY_VLOG_NONE, NULL, LYVE_REFERENCE, "Failed to find matching hash for a top-level node"
+            LOGVAL(lybctx->lybctx->ctx, LY_VLOG_NONE, NULL, LYVE_REFERENCE, "Failed to find matching hash for a top-level node"
                    " from \"%s\".", mod->name);
         } else {
-            LOGVAL(lybctx->ctx, LY_VLOG_LYSC, sparent, LYVE_REFERENCE, "Failed to find matching hash for a child node"
+            LOGVAL(lybctx->lybctx->ctx, LY_VLOG_LYSC, sparent, LYVE_REFERENCE, "Failed to find matching hash for a child node"
                    " of \"%s\".", sparent->name);
         }
         return LY_EVALID;
-    } else if (sibling && (ret = lyb_parse_check_schema(lybctx, sibling))) {
+    } else if (sibling && (ret = lyd_parser_check_schema((struct lyd_ctx *)lybctx, sibling))) {
         return ret;
     }
 
@@ -683,7 +657,7 @@
  * @param[in] lybctx LYB context.
  */
 static void
-lyb_skip_subtree(struct lyd_lyb_ctx *lybctx)
+lyb_skip_subtree(struct lylyb_ctx *lybctx)
 {
     do {
         /* first skip any meta information inside */
@@ -710,20 +684,21 @@
     const struct lys_module *mod;
     const struct lysc_node *snode = NULL;
     struct lyd_meta *meta = NULL, *m;
-    struct ly_attr *attr = NULL, *a;
+    struct lyd_attr *attr = NULL, *a;
     struct ly_prefix *val_prefs = NULL;
     LYD_ANYDATA_VALUETYPE value_type;
-    char *value = NULL, *name = NULL, *prefix = NULL, *ns = NULL;
+    char *value = NULL, *name = NULL, *prefix = NULL, *module_key = NULL;
     int dynamic = 0;
     LYD_FORMAT format = 0;
     int prev_lo;
+    const struct ly_ctx *ctx = lybctx->lybctx->ctx;
 
     /* register a new subtree */
-    LY_CHECK_GOTO(ret = lyb_read_start_subtree(lybctx), cleanup);
+    LY_CHECK_GOTO(ret = lyb_read_start_subtree(lybctx->lybctx), cleanup);
 
     if (!parent) {
         /* top-level, read module name */
-        ret = lyb_parse_model(lybctx, &mod);
+        ret = lyb_parse_model(lybctx->lybctx, lybctx->parse_options, &mod);
         LY_CHECK_GOTO(ret, cleanup);
 
         /* read hash, find the schema node starting from mod */
@@ -737,7 +712,7 @@
 
      if (!snode && !(lybctx->parse_options & LYD_PARSE_OPAQ)) {
         /* unknown data, skip them */
-        lyb_skip_subtree(lybctx);
+        lyb_skip_subtree(lybctx->lybctx);
         goto stop_subtree;
      }
 
@@ -746,73 +721,67 @@
         ret = lyb_parse_metadata(lybctx, snode, &meta);
         LY_CHECK_GOTO(ret, cleanup);
     } else {
-        ret = lyb_parse_attributes(lybctx, &attr);
+        ret = lyb_parse_attributes(lybctx->lybctx, &attr);
         LY_CHECK_GOTO(ret, cleanup);
     }
 
     if (!snode) {
         /* parse prefix */
-        ret = lyb_read_string(&prefix, 1, lybctx);
+        ret = lyb_read_string(&prefix, 1, lybctx->lybctx);
         LY_CHECK_GOTO(ret, cleanup);
 
-        /* parse namespace */
-        ret = lyb_read_string(&ns, 1, lybctx);
+        /* parse module key */
+        ret = lyb_read_string(&module_key, 1, lybctx->lybctx);
         LY_CHECK_GOTO(ret, cleanup);
 
         /* parse name */
-        ret = lyb_read_string(&name, 1, lybctx);
+        ret = lyb_read_string(&name, 1, lybctx->lybctx);
         LY_CHECK_GOTO(ret, cleanup);
 
         /* parse value prefixes */
-        ret = lyb_parse_opaq_prefixes(lybctx, &val_prefs);
+        ret = lyb_parse_opaq_prefixes(lybctx->lybctx, &val_prefs);
         LY_CHECK_GOTO(ret, cleanup);
 
         /* parse format */
-        lyb_read((uint8_t *)&format, 1, lybctx);
+        lyb_read((uint8_t *)&format, 1, lybctx->lybctx);
 
         /* parse value */
-        ret = lyb_read_string(&value, 0, lybctx);
+        ret = lyb_read_string(&value, 0, lybctx->lybctx);
         LY_CHECK_GOTO(ret, cleanup);
         dynamic = 1;
 
         /* create node */
-        ret = lyd_create_opaq(lybctx->ctx, name, strlen(name), value, strlen(value), &dynamic, format, val_prefs, prefix,
-                              strlen(prefix), ns, &node);
+        ret = lyd_create_opaq(ctx, name, strlen(name), value, strlen(value), &dynamic, 0, format, val_prefs, prefix,
+                              ly_strlen(prefix), module_key, ly_strlen(module_key), &node);
         LY_CHECK_GOTO(ret, cleanup);
 
         /* process children */
-        while (LYB_LAST_SUBTREE(lybctx).written) {
+        while (LYB_LAST_SUBTREE(lybctx->lybctx).written) {
             ret = lyb_parse_subtree_r(lybctx, (struct lyd_node_inner *)node, NULL);
             LY_CHECK_GOTO(ret, cleanup);
         }
     } else if (snode->nodetype & LYD_NODE_TERM) {
         /* parse value */
-        ret = lyb_read_string(&value, 0, lybctx);
+        ret = lyb_read_string(&value, 0, lybctx->lybctx);
         LY_CHECK_GOTO(ret, cleanup);
         dynamic = 1;
 
         /* create node */
-        ret = lyd_create_term(snode, value, strlen(value), &dynamic, lydjson_resolve_prefix, NULL, LYD_JSON, &node);
+        ret = lyd_parser_create_term((struct lyd_ctx*)lybctx, snode, value, ly_strlen(value), &dynamic, 0,
+                                     lydjson_resolve_prefix, NULL, LYD_JSON, &node);
         if (dynamic) {
             free(value);
             dynamic = 0;
         }
         value = NULL;
-        if (ret == LY_EINCOMPLETE) {
-            if (!(lybctx->parse_options & LYD_PARSE_ONLY)) {
-                ly_set_add(&lybctx->unres_node_type, node, LY_SET_OPT_USEASLIST);
-            }
-            ret = LY_SUCCESS;
-        } else if (ret) {
-            goto cleanup;
-        }
+        LY_CHECK_GOTO(ret, cleanup);
     } else if (snode->nodetype & LYD_NODE_INNER) {
         /* create node */
         ret = lyd_create_inner(snode, &node);
         LY_CHECK_GOTO(ret, cleanup);
 
         /* process children */
-        while (LYB_LAST_SUBTREE(lybctx).written) {
+        while (LYB_LAST_SUBTREE(lybctx->lybctx).written) {
             ret = lyb_parse_subtree_r(lybctx, (struct lyd_node_inner *)node, NULL);
             LY_CHECK_GOTO(ret, cleanup);
         }
@@ -831,19 +800,19 @@
 
         if (snode->nodetype & (LYS_RPC | LYS_ACTION | LYS_NOTIF)) {
             /* rememeber the RPC/action/notification */
-            lybctx->op_ntf = node;
+            lybctx->op_node = node;
         }
     } else if (snode->nodetype & LYD_NODE_ANY) {
         /* parse value type */
-        lyb_read((uint8_t *)&value_type, sizeof value_type, lybctx);
+        lyb_read((uint8_t *)&value_type, sizeof value_type, lybctx->lybctx);
         if (value_type == LYD_ANYDATA_DATATREE) {
             /* invalid situation */
-            LOGINT(lybctx->ctx);
+            LOGINT(ctx);
             goto cleanup;
         }
 
         /* read anydata content */
-        ret = lyb_read_string(&value, 0, lybctx);
+        ret = lyb_read_string(&value, 0, lybctx->lybctx);
         LY_CHECK_GOTO(ret, cleanup);
         dynamic = 1;
 
@@ -852,7 +821,7 @@
             prev_lo = ly_log_options(0);
 
             /* try to parse LYB into a data tree */
-            if (lyd_parse_data_mem((struct ly_ctx *)lybctx->ctx, value, LYD_LYB, LYD_PARSE_ONLY | LYD_PARSE_OPAQ | LYD_PARSE_STRICT, 0, &tree) == LY_SUCCESS) {
+            if (lyd_parse_data_mem(ctx, value, LYD_LYB, LYD_PARSE_ONLY | LYD_PARSE_OPAQ | LYD_PARSE_STRICT, 0, &tree) == LY_SUCCESS) {
                 /* successfully parsed */
                 free(value);
                 value = (char *)tree;
@@ -902,20 +871,20 @@
 
 stop_subtree:
     /* end the subtree */
-    ret = lyb_read_stop_subtree(lybctx);
+    ret = lyb_read_stop_subtree(lybctx->lybctx);
     LY_CHECK_GOTO(ret, cleanup);
 
 cleanup:
     free(prefix);
-    free(ns);
+    free(module_key);
     free(name);
     if (dynamic) {
         free(value);
     }
-    ly_free_val_prefs(lybctx->ctx, val_prefs);
+    ly_free_val_prefs(ctx, val_prefs);
 
     lyd_free_meta_siblings(meta);
-    ly_free_attr_siblings(lybctx->ctx, attr);
+    ly_free_attr_siblings(ctx, attr);
     lyd_free_tree(node);
     return ret;
 }
@@ -927,7 +896,7 @@
  * @return LY_ERR value.
  */
 static LY_ERR
-lyb_parse_data_models(struct lyd_lyb_ctx *lybctx)
+lyb_parse_data_models(struct lylyb_ctx *lybctx, uint32_t parse_options)
 {
     LY_ERR ret;
     uint32_t count;
@@ -941,7 +910,7 @@
 
         /* read modules */
         for (u = 0; u < count; ++u) {
-            ret = lyb_parse_model(lybctx, &lybctx->models[u]);
+            ret = lyb_parse_model(lybctx, parse_options, &lybctx->models[u]);
             LY_CHECK_RET(ret);
             LY_ARRAY_INCREMENT(lybctx->models);
         }
@@ -957,7 +926,7 @@
  * @return LY_ERR value.
  */
 static LY_ERR
-lyb_parse_magic_number(struct lyd_lyb_ctx *lybctx)
+lyb_parse_magic_number(struct lylyb_ctx *lybctx)
 {
     char magic_byte = 0;
 
@@ -989,7 +958,7 @@
  * @return LY_ERR value.
  */
 static LY_ERR
-lyb_parse_header(struct lyd_lyb_ctx *lybctx)
+lyb_parse_header(struct lylyb_ctx *lybctx)
 {
     uint8_t byte = 0;
 
@@ -1005,198 +974,139 @@
     return LY_SUCCESS;
 }
 
-LY_ERR
-lyd_parse_lyb_data(const struct ly_ctx *ctx, struct ly_in *in, int parse_options, int validate_options,
-                   struct lyd_node **tree)
+/*
+ * @param[in] ctx libyang context for logging
+ * @param[in] parent Parent node where to connect the parsed data, required for reply where the reply data are connected with the request operation
+ * @param[in] in Input structure.
+ * @param[in] parse_options Options for parser, see @ref dataparseroptions.
+ * @param[in] validate_options Options for the validation phase, see @ref datavalidationoptions.
+ * @param[in] data_type Internal data parser flag to distnguish type of the data to parse (RPC/Reply/Notification/regular data].
+ * @param[out] tree_p Parsed data tree. Note that NULL can be a valid result.
+ * @param[out] op_p Optional pointer to the actual operation. Useful for action and inner notifications.
+ * @param[out] lydctx_p Data parser context to finish validation.
+ */
+static LY_ERR
+lyd_parse_lyb_(const struct ly_ctx *ctx, struct lyd_node_inner **parent, struct ly_in *in, int parse_options, int validate_options,
+               int data_type, struct lyd_node **tree_p, struct lyd_node **op_p, struct lyd_ctx **lydctx_p)
 {
     LY_ERR ret = LY_SUCCESS;
-    struct lyd_lyb_ctx lybctx = {0};
+    struct lyd_lyb_ctx *lybctx;
+    struct lyd_node *tree = NULL;
 
     assert(!(parse_options & ~LYD_PARSE_OPTS_MASK));
     assert(!(validate_options & ~LYD_VALIDATE_OPTS_MASK));
 
-    *tree = NULL;
+    lybctx = calloc(1, sizeof *lybctx);
+    LY_CHECK_ERR_RET(!lybctx, LOGMEM(ctx), LY_EMEM);
+    lybctx->lybctx = calloc(1, sizeof *lybctx->lybctx);
+    LY_CHECK_ERR_RET(!lybctx->lybctx, LOGMEM(ctx), LY_EMEM);
 
-    lybctx.in = in;
-    lybctx.ctx = ctx;
-    lybctx.parse_options = parse_options;
-    lybctx.validate_options = validate_options;
+    lybctx->lybctx->in = in;
+    lybctx->lybctx->ctx = ctx;
+    lybctx->parse_options = parse_options;
+    lybctx->validate_options = validate_options;
+    lybctx->int_opts = data_type;
+    lybctx->free = lyd_lyb_ctx_free;
 
     /* read magic number */
-    ret = lyb_parse_magic_number(&lybctx);
+    ret = lyb_parse_magic_number(lybctx->lybctx);
     LY_CHECK_GOTO(ret, cleanup);
 
     /* read header */
-    ret = lyb_parse_header(&lybctx);
+    ret = lyb_parse_header(lybctx->lybctx);
     LY_CHECK_GOTO(ret, cleanup);
 
     /* read used models */
-    ret = lyb_parse_data_models(&lybctx);
+    ret = lyb_parse_data_models(lybctx->lybctx, lybctx->parse_options);
     LY_CHECK_GOTO(ret, cleanup);
 
     /* read subtree(s) */
-    while (lybctx.in->current[0]) {
-        ret = lyb_parse_subtree_r(&lybctx, NULL, tree);
+    while (lybctx->lybctx->in->current[0]) {
+        ret = lyb_parse_subtree_r(lybctx, parent ? *parent : NULL, &tree);
         LY_CHECK_GOTO(ret, cleanup);
     }
 
     /* read the last zero, parsing finished */
-    ly_in_skip(lybctx.in, 1);
+    ly_in_skip(lybctx->lybctx->in, 1);
 
-    /* TODO validation */
+    if (data_type == LYD_INTOPT_RPC) {
+        /* make sure we have parsed some operation */
+        if (!lybctx->op_node) {
+            LOGVAL(ctx, LY_VLOG_NONE, NULL, LYVE_DATA, "Missing the \"rpc\"/\"action\" node.");
+            ret = LY_EVALID;
+            goto cleanup;
+        }
+
+        if (op_p) {
+            *op_p = lybctx->op_node;
+        }
+        assert(tree);
+    } else if (data_type == LYD_INTOPT_REPLY) {
+        struct lyd_node_inner *iter;
+
+        assert(parent);
+
+        if (op_p) {
+            *op_p = (struct lyd_node*)(*parent);
+        }
+        for (iter = *parent; iter->parent; iter = iter->parent);
+        tree = (struct lyd_node *)iter;
+        *parent = NULL;
+
+    } else if (data_type == LYD_INTOPT_NOTIF) {
+        /* make sure we have parsed some notification */
+        if (!lybctx->op_node) {
+            LOGVAL(ctx, LY_VLOG_NONE, NULL, LYVE_DATA, "Missing the \"notification\" node.");
+            ret = LY_EVALID;
+            goto cleanup;
+        }
+
+        if (op_p) {
+            *op_p = lybctx->op_node;
+        }
+        assert(tree);
+    }
 
 cleanup:
-    LY_ARRAY_FREE(lybctx.subtrees);
-    LY_ARRAY_FREE(lybctx.models);
-    ly_set_erase(&lybctx.unres_node_type, NULL);
-    ly_set_erase(&lybctx.unres_meta_type, NULL);
-    ly_set_erase(&lybctx.when_check, NULL);
-
-    if (ret) {
-        lyd_free_all(*tree);
-        *tree = NULL;
+    if (ret || !lydctx_p) {
+        lyd_lyb_ctx_free((struct lyd_ctx *)lybctx);
+        if (ret) {
+            lyd_free_all(tree);
+        }
+    } else {
+        *lydctx_p = (struct lyd_ctx *)lybctx;
+        if (tree_p) {
+            *tree_p = tree;
+        }
     }
     return ret;
 }
 
 LY_ERR
-lyd_parse_lyb_rpc(const struct ly_ctx *ctx, struct ly_in *in, struct lyd_node **tree, struct lyd_node **op)
+lyd_parse_lyb_data(const struct ly_ctx *ctx, struct ly_in *in, int parse_options, int validate_options,
+                   struct lyd_node **tree_p, struct lyd_ctx **lydctx_p)
 {
-    LY_ERR ret = LY_SUCCESS;
-    struct lyd_lyb_ctx lybctx = {0};
-
-    lybctx.in = in;
-    lybctx.ctx = ctx;
-    lybctx.parse_options = LYD_PARSE_ONLY | LYD_PARSE_STRICT;
-    lybctx.int_opts = LYD_INTOPT_RPC;
-
-    *tree = NULL;
-    if (op) {
-        *op = NULL;
-    }
-
-    /* read magic number */
-    ret = lyb_parse_magic_number(&lybctx);
-    LY_CHECK_GOTO(ret, cleanup);
-
-    /* read header */
-    ret = lyb_parse_header(&lybctx);
-    LY_CHECK_GOTO(ret, cleanup);
-
-    /* read used models */
-    ret = lyb_parse_data_models(&lybctx);
-    LY_CHECK_GOTO(ret, cleanup);
-
-    /* read subtree(s) */
-    while (lybctx.in->current[0]) {
-        ret = lyb_parse_subtree_r(&lybctx, NULL, tree);
-        LY_CHECK_GOTO(ret, cleanup);
-    }
-
-    /* read the last zero, parsing finished */
-    ly_in_skip(lybctx.in, 1);
-
-    /* make sure we have parsed some operation */
-    if (!lybctx.op_ntf) {
-        LOGVAL(ctx, LY_VLOG_NONE, NULL, LYVE_DATA, "Missing the \"rpc\"/\"action\" node.");
-        ret = LY_EVALID;
-        goto cleanup;
-    }
-
-    if (op) {
-        *op = lybctx.op_ntf;
-    }
-    assert(*tree);
-
-cleanup:
-    LY_ARRAY_FREE(lybctx.subtrees);
-    LY_ARRAY_FREE(lybctx.models);
-    assert(!lybctx.unres_node_type.count && !lybctx.unres_meta_type.count && !lybctx.when_check.count);
-
-    if (ret) {
-        lyd_free_all(*tree);
-        *tree = NULL;
-    }
-    return ret;
+    return lyd_parse_lyb_(ctx, NULL, in, parse_options, validate_options, 0, tree_p, NULL, lydctx_p);
 }
 
 LY_ERR
-lyd_parse_lyb_notif(const struct ly_ctx *ctx, struct ly_in *in, struct lyd_node **tree, struct lyd_node **ntf)
+lyd_parse_lyb_rpc(const struct ly_ctx *ctx, struct ly_in *in, struct lyd_node **tree_p, struct lyd_node **op_p)
 {
-    LY_ERR ret = LY_SUCCESS;
-    struct lyd_lyb_ctx lybctx = {0};
-
-    lybctx.in = in;
-    lybctx.ctx = ctx;
-    lybctx.parse_options = LYD_PARSE_ONLY | LYD_PARSE_STRICT;
-    lybctx.int_opts = LYD_INTOPT_NOTIF;
-
-    *tree = NULL;
-    if (ntf) {
-        *ntf = NULL;
-    }
-
-    /* read magic number */
-    ret = lyb_parse_magic_number(&lybctx);
-    LY_CHECK_GOTO(ret, cleanup);
-
-    /* read header */
-    ret = lyb_parse_header(&lybctx);
-    LY_CHECK_GOTO(ret, cleanup);
-
-    /* read used models */
-    ret = lyb_parse_data_models(&lybctx);
-    LY_CHECK_GOTO(ret, cleanup);
-
-    /* read subtree(s) */
-    while (lybctx.in->current[0]) {
-        ret = lyb_parse_subtree_r(&lybctx, NULL, tree);
-        LY_CHECK_GOTO(ret, cleanup);
-    }
-
-    /* read the last zero, parsing finished */
-    ly_in_skip(lybctx.in, 1);
-
-    /* make sure we have parsed some notification */
-    if (!lybctx.op_ntf) {
-        LOGVAL(ctx, LY_VLOG_NONE, NULL, LYVE_DATA, "Missing the \"notification\" node.");
-        ret = LY_EVALID;
-        goto cleanup;
-    }
-
-    if (ntf) {
-        *ntf = lybctx.op_ntf;
-    }
-    assert(*tree);
-
-cleanup:
-    LY_ARRAY_FREE(lybctx.subtrees);
-    LY_ARRAY_FREE(lybctx.models);
-    assert(!lybctx.unres_node_type.count && !lybctx.unres_meta_type.count && !lybctx.when_check.count);
-
-    if (ret) {
-        lyd_free_all(*tree);
-        *tree = NULL;
-    }
-    return ret;
+    return lyd_parse_lyb_(ctx, NULL, in, LYD_PARSE_ONLY | LYD_PARSE_STRICT, 0, LYD_INTOPT_RPC, tree_p, op_p, NULL);
 }
 
 LY_ERR
-lyd_parse_lyb_reply(const struct lyd_node *request, struct ly_in *in, struct lyd_node **tree, struct lyd_node **op)
+lyd_parse_lyb_notif(const struct ly_ctx *ctx, struct ly_in *in, struct lyd_node **tree_p, struct lyd_node **ntf_p)
 {
-    LY_ERR ret = LY_SUCCESS;
-    struct lyd_lyb_ctx lybctx = {0};
-    struct lyd_node *iter, *req_op, *rep_op = NULL;
+    return lyd_parse_lyb_(ctx, NULL, in, LYD_PARSE_ONLY | LYD_PARSE_STRICT, 0, LYD_INTOPT_NOTIF, tree_p, ntf_p, NULL);
+}
 
-    lybctx.in = in;
-    lybctx.ctx = LYD_NODE_CTX(request);
-    lybctx.parse_options = LYD_PARSE_ONLY | LYD_PARSE_STRICT;
-    lybctx.int_opts = LYD_INTOPT_REPLY;
-
-    *tree = NULL;
-    if (op) {
-        *op = NULL;
-    }
+LY_ERR
+lyd_parse_lyb_reply(const struct lyd_node *request, struct ly_in *in, struct lyd_node **tree_p, struct lyd_node **op_p)
+{
+    LY_ERR ret;
+    struct lyd_node *req_op, *rep_op = NULL;
+    const struct ly_ctx *ctx = LYD_NODE_CTX(request);
 
     /* find request OP */
     LYD_TREE_DFS_BEGIN((struct lyd_node *)request, req_op) {
@@ -1207,52 +1117,16 @@
     }
     if (!(req_op->schema->nodetype & (LYS_RPC | LYS_ACTION))) {
         LOGERR(LYD_NODE_CTX(request), LY_EINVAL, "No RPC/action in the request found.");
-        ret = LY_EINVAL;
-        goto cleanup;
+        return LY_EINVAL;
     }
 
     /* duplicate request OP with parents */
-    ret = lyd_dup_single(req_op, NULL, LYD_DUP_WITH_PARENTS, &rep_op);
-    LY_CHECK_GOTO(ret, cleanup);
+    LY_CHECK_RET(lyd_dup_single(req_op, NULL, LYD_DUP_WITH_PARENTS, &rep_op));
 
-    /* read magic number */
-    ret = lyb_parse_magic_number(&lybctx);
-    LY_CHECK_GOTO(ret, cleanup);
+    ret = lyd_parse_lyb_(ctx, (struct lyd_node_inner **)&rep_op, in, LYD_PARSE_ONLY | LYD_PARSE_STRICT, 0, LYD_INTOPT_REPLY, tree_p, op_p, NULL);
 
-    /* read header */
-    ret = lyb_parse_header(&lybctx);
-    LY_CHECK_GOTO(ret, cleanup);
-
-    /* read used models */
-    ret = lyb_parse_data_models(&lybctx);
-    LY_CHECK_GOTO(ret, cleanup);
-
-    /* read subtree(s) */
-    while (lybctx.in->current[0]) {
-        ret = lyb_parse_subtree_r(&lybctx, (struct lyd_node_inner *)rep_op, NULL);
-        LY_CHECK_GOTO(ret, cleanup);
-    }
-
-    /* read the last zero, parsing finished */
-    ly_in_skip(lybctx.in, 1);
-
-    if (op) {
-        *op = rep_op;
-    }
-    for (iter = rep_op; iter->parent; iter = (struct lyd_node *)iter->parent);
-    *tree = iter;
-    rep_op = NULL;
-
-cleanup:
     lyd_free_all(rep_op);
-    LY_ARRAY_FREE(lybctx.subtrees);
-    LY_ARRAY_FREE(lybctx.models);
-    assert(!lybctx.unres_node_type.count && !lybctx.unres_meta_type.count && !lybctx.when_check.count);
 
-    if (ret) {
-        lyd_free_all(*tree);
-        *tree = NULL;
-    }
     return ret;
 }
 
@@ -1260,7 +1134,7 @@
 lyd_lyb_data_length(const char *data)
 {
     LY_ERR ret = LY_SUCCESS;
-    struct lyd_lyb_ctx lybctx = {0};
+    struct lylyb_ctx *lybctx;
     int count, i;
     size_t len;
     uint8_t buf[LYB_SIZE_MAX];
@@ -1269,53 +1143,56 @@
         return -1;
     }
 
-    ret = ly_in_new_memory(data, &lybctx.in);
+    lybctx = calloc(1, sizeof *lybctx);
+    LY_CHECK_ERR_RET(!lybctx, LOGMEM(NULL), LY_EMEM);
+    ret = ly_in_new_memory(data, &lybctx->in);
     LY_CHECK_GOTO(ret, cleanup);
 
     /* read magic number */
-    ret = lyb_parse_magic_number(&lybctx);
+    ret = lyb_parse_magic_number(lybctx);
     LY_CHECK_GOTO(ret, cleanup);
 
     /* read header */
-    ret = lyb_parse_header(&lybctx);
+    ret = lyb_parse_header(lybctx);
     LY_CHECK_GOTO(ret, cleanup);
 
     /* read model count */
-    lyb_read_number(&count, sizeof count, 2, &lybctx);
+    lyb_read_number(&count, sizeof count, 2, lybctx);
 
     /* read all models */
     for (i = 0; i < count; ++i) {
         /* module name length */
         len = 0;
-        lyb_read_number(&len, sizeof len, 2, &lybctx);
+        lyb_read_number(&len, sizeof len, 2, lybctx);
 
         /* model name */
-        lyb_read(buf, len, &lybctx);
+        lyb_read(buf, len, lybctx);
 
         /* revision */
-        lyb_read(buf, 2, &lybctx);
+        lyb_read(buf, 2, lybctx);
     }
 
-    while (lybctx.in->current[0]) {
+    while (lybctx->in->current[0]) {
         /* register a new subtree */
-        ret = lyb_read_start_subtree(&lybctx);
+        ret = lyb_read_start_subtree(lybctx);
         LY_CHECK_GOTO(ret, cleanup);
 
         /* skip it */
-        lyb_skip_subtree(&lybctx);
+        lyb_skip_subtree(lybctx);
 
         /* subtree finished */
-        ret = lyb_read_stop_subtree(&lybctx);
+        ret = lyb_read_stop_subtree(lybctx);
         LY_CHECK_GOTO(ret, cleanup);
     }
 
     /* read the last zero, parsing finished */
-    ly_in_skip(lybctx.in, 1);
+    ly_in_skip(lybctx->in, 1);
 
 cleanup:
-    count = lybctx.in->current - lybctx.in->start;
+    count = lybctx->in->current - lybctx->in->start;
 
-    ly_in_free(lybctx.in, 0);
-    LY_ARRAY_FREE(lybctx.subtrees);
+    ly_in_free(lybctx->in, 0);
+    lylyb_ctx_free(lybctx);
+
     return ret ? -1 : count;
 }
diff --git a/src/parser_xml.c b/src/parser_xml.c
index a3c8acf..ffca41f 100644
--- a/src/parser_xml.c
+++ b/src/parser_xml.c
@@ -31,21 +31,37 @@
 
 /**
  * @brief Internal context for XML YANG data parser.
+ *
+ * Note that the structure maps to the lyd_ctx which is common for all the data parsers
  */
 struct lyd_xml_ctx {
-    struct lyxml_ctx *xmlctx;        /**< XML context */
+    uint32_t parse_options;        /**< various @ref dataparseroptions. */
+    uint32_t validate_options;     /**< various @ref datavalidationoptions. */
+    uint32_t int_opts;             /**< internal data parser options */
+    uint32_t path_len;             /**< used bytes in the path buffer */
+    char path[LYD_PARSER_BUFSIZE]; /**< buffer for the generated path */
+    struct ly_set unres_node_type; /**< set of nodes validated with LY_EINCOMPLETE result */
+    struct ly_set unres_meta_type; /**< set of metadata validated with LY_EINCOMPLETE result */
+    struct ly_set when_check;      /**< set of nodes with "when" conditions */
+    struct lyd_node *op_node;      /**< if an RPC/action/notification is being parsed, store the pointer to it */
 
-    uint32_t options;                /**< various @ref dataparseroptions. */
-    uint32_t int_opts;               /**< internal data parser options */
-    uint32_t path_len;               /**< used bytes in the path buffer */
-#define LYD_PARSER_BUFSIZE 4078
-    char path[LYD_PARSER_BUFSIZE];   /**< buffer for the generated path */
-    struct ly_set unres_node_type;   /**< set of nodes validated with LY_EINCOMPLETE result */
-    struct ly_set unres_meta_type;   /**< set of metadata validated with LY_EINCOMPLETE result */
-    struct ly_set when_check;        /**< set of nodes with "when" conditions */
-    struct lyd_node *op_ntf;         /**< if an RPC/action/notification is being parsed, store the pointer to it */
+    /* callbacks */
+    lyd_ctx_free_clb free;           /* destructor */
+    ly_resolve_prefix_clb resolve_prefix;
+
+    struct lyxml_ctx *xmlctx;      /**< XML context */
 };
 
+void
+lyd_xml_ctx_free(struct lyd_ctx *lydctx)
+{
+    struct lyd_xml_ctx *ctx = (struct lyd_xml_ctx *)lydctx;
+
+    lyd_ctx_free(lydctx);
+    lyxml_ctx_free(ctx->xmlctx);
+    free(ctx);
+}
+
 /**
  * @brief XML-parser's implementation of ly_type_resolve_prefix() callback to provide mapping between prefixes used
  * in the values to the schema via XML namespaces.
@@ -65,14 +81,14 @@
 }
 
 static LY_ERR
-lydxml_metadata(struct lyxml_ctx *xmlctx, const struct lysc_node *sparent, int strict, struct ly_set *unres_meta_type,
-                struct lyd_meta **meta)
+lydxml_metadata(struct lyd_xml_ctx *lydctx, const struct lysc_node *sparent, struct lyd_meta **meta)
 {
     LY_ERR ret = LY_EVALID;
     const struct lyxml_ns *ns;
     struct lys_module *mod;
     const char *name;
     size_t name_len;
+    struct lyxml_ctx *xmlctx = lydctx->xmlctx;
 
     *meta = NULL;
 
@@ -80,7 +96,7 @@
         if (!xmlctx->prefix_len) {
             /* in XML, all attributes must be prefixed
              * TODO exception for NETCONF filters which are supposed to map to the ietf-netconf without prefix */
-            if (strict) {
+            if (lydctx->parse_options & LYD_PARSE_STRICT) {
                 LOGVAL(xmlctx->ctx, LY_VLOG_LINE, &xmlctx->line, LYVE_REFERENCE, "Missing mandatory prefix for XML metadata \"%.*s\".",
                        xmlctx->name_len, xmlctx->name);
                 goto cleanup;
@@ -104,7 +120,7 @@
         mod = ly_ctx_get_module_implemented_ns(xmlctx->ctx, ns->uri);
         if (!mod) {
             /* module is not implemented or not present in the schema */
-            if (strict) {
+            if (lydctx->parse_options & LYD_PARSE_STRICT) {
                 LOGVAL(xmlctx->ctx, LY_VLOG_LINE, &xmlctx->line, LYVE_REFERENCE,
                        "Unknown (or not implemented) YANG module with namespace \"%s\" for metadata \"%.*s%s%.*s\".",
                        ns->uri, xmlctx->prefix_len, xmlctx->prefix, xmlctx->prefix_len ? ":" : "", xmlctx->name_len,
@@ -121,15 +137,9 @@
         assert(xmlctx->status == LYXML_ATTR_CONTENT);
 
         /* create metadata */
-        ret = lyd_create_meta(NULL, meta, mod, name, name_len, xmlctx->value, xmlctx->value_len, &xmlctx->dynamic,
-                              lydxml_resolve_prefix, xmlctx, LYD_XML, sparent);
-        if (ret == LY_EINCOMPLETE) {
-            if (unres_meta_type) {
-                ly_set_add(unres_meta_type, *meta, LY_SET_OPT_USEASLIST);
-            }
-        } else if (ret) {
-            goto cleanup;
-        }
+        ret = lyd_parser_create_meta((struct lyd_ctx*)lydctx, NULL, meta, mod, name, name_len, xmlctx->value, xmlctx->value_len,
+                                     &xmlctx->dynamic, 0, lydxml_resolve_prefix, xmlctx, LYD_XML, sparent);
+        LY_CHECK_GOTO(ret, cleanup);
 
         /* next attribute */
         LY_CHECK_GOTO(ret = lyxml_ctx_next(xmlctx), cleanup);
@@ -146,12 +156,12 @@
 }
 
 static LY_ERR
-lydxml_attrs(struct lyxml_ctx *xmlctx, struct ly_attr **attr)
+lydxml_attrs(struct lyxml_ctx *xmlctx, struct lyd_attr **attr)
 {
     LY_ERR ret = LY_SUCCESS;
     const struct lyxml_ns *ns;
     struct ly_prefix *val_prefs;
-    struct ly_attr *attr2;
+    struct lyd_attr *attr2;
     const char *name, *prefix;
     size_t name_len, prefix_len;
 
@@ -189,8 +199,9 @@
         LY_CHECK_GOTO(ret = lyxml_get_prefixes(xmlctx, xmlctx->value, xmlctx->value_len, &val_prefs), cleanup);
 
         /* attr2 is always changed to the created attribute */
-        ret = ly_create_attr(NULL, &attr2, xmlctx->ctx, name, name_len, xmlctx->value, xmlctx->value_len,
-                             &xmlctx->dynamic, LYD_XML, val_prefs, prefix, prefix_len, ns ? ns->uri : NULL);
+        ret = lyd_create_attr(NULL, &attr2, xmlctx->ctx, name, name_len, xmlctx->value, xmlctx->value_len,
+                              &xmlctx->dynamic, 0, LYD_XML, val_prefs, prefix, prefix_len,
+                              ns ? ns->uri : NULL, ns ? strlen(ns->uri) : 0);
         LY_CHECK_GOTO(ret, cleanup);
 
         if (!*attr) {
@@ -307,7 +318,7 @@
 }
 
 static LY_ERR
-lydxml_data_check_schema(struct lyd_xml_ctx *lydctx, const struct lysc_node **snode)
+lydxml_data_check_opaq(struct lyd_xml_ctx *lydctx, const struct lysc_node **snode)
 {
     LY_ERR ret = LY_SUCCESS;
     enum LYXML_PARSER_STATUS prev_status;
@@ -315,40 +326,7 @@
     size_t pprefix_len, pname_len;
     struct lyxml_ctx *xmlctx = lydctx->xmlctx;
 
-    if ((lydctx->options & LYD_PARSE_NO_STATE) && ((*snode)->flags & LYS_CONFIG_R)) {
-        LOGVAL(xmlctx->ctx, LY_VLOG_LINE, &xmlctx->line, LY_VCODE_INNODE, "state", (*snode)->name);
-        return LY_EVALID;
-    }
-
-    if ((*snode)->nodetype & (LYS_RPC | LYS_ACTION)) {
-        if (lydctx->int_opts & LYD_INTOPT_RPC) {
-            if (lydctx->op_ntf) {
-                LOGVAL(xmlctx->ctx, LY_VLOG_LINE, &xmlctx->line, LYVE_DATA, "Unexpected %s element \"%s\", %s \"%s\" already parsed.",
-                       lys_nodetype2str((*snode)->nodetype), (*snode)->name,
-                       lys_nodetype2str(lydctx->op_ntf->schema->nodetype), lydctx->op_ntf->schema->name);
-                return LY_EVALID;
-            }
-        } else {
-            LOGVAL(xmlctx->ctx, LY_VLOG_LINE, &xmlctx->line, LYVE_DATA, "Unexpected %s element \"%s\".",
-                   lys_nodetype2str((*snode)->nodetype), (*snode)->name);
-            return LY_EVALID;
-        }
-    } else if ((*snode)->nodetype == LYS_NOTIF) {
-        if (lydctx->int_opts & LYD_INTOPT_NOTIF) {
-            if (lydctx->op_ntf) {
-                LOGVAL(xmlctx->ctx, LY_VLOG_LINE, &xmlctx->line, LYVE_DATA, "Unexpected %s element \"%s\", %s \"%s\" already parsed.",
-                       lys_nodetype2str((*snode)->nodetype), (*snode)->name,
-                       lys_nodetype2str(lydctx->op_ntf->schema->nodetype), lydctx->op_ntf->schema->name);
-                return LY_EVALID;
-            }
-        } else {
-            LOGVAL(xmlctx->ctx, LY_VLOG_LINE, &xmlctx->line, LYVE_DATA, "Unexpected %s element \"%s\".",
-                   lys_nodetype2str((*snode)->nodetype), (*snode)->name);
-            return LY_EVALID;
-        }
-    }
-
-    if ((lydctx->options & LYD_PARSE_OPAQ) && ((*snode)->nodetype & (LYD_NODE_TERM | LYS_LIST))) {
+    if ((lydctx->parse_options & LYD_PARSE_OPAQ) && ((*snode)->nodetype & (LYD_NODE_TERM | LYS_LIST))) {
         /* backup parser */
         prev_status = xmlctx->status;
         pprefix = xmlctx->prefix;
@@ -416,7 +394,7 @@
     const struct ly_ctx *ctx;
     const struct lyxml_ns *ns;
     struct lyd_meta *meta = NULL, *m;
-    struct ly_attr *attr = NULL, *a;
+    struct lyd_attr *attr = NULL, *a;
     const struct lysc_node *snode;
     struct lys_module *mod;
     uint32_t prev_opts;
@@ -446,13 +424,13 @@
         }
         mod = ly_ctx_get_module_implemented_ns(ctx, ns->uri);
         if (!mod) {
-            if (lydctx->options & LYD_PARSE_STRICT) {
+            if (lydctx->parse_options & LYD_PARSE_STRICT) {
                 LOGVAL(ctx, LY_VLOG_LINE, &xmlctx->line, LYVE_REFERENCE, "No module with namespace \"%s\" in the context.",
                        ns->uri);
                 ret = LY_EVALID;
                 goto cleanup;
             }
-            if (!(lydctx->options & LYD_PARSE_OPAQ)) {
+            if (!(lydctx->parse_options & LYD_PARSE_OPAQ)) {
                 /* skip element with children */
                 LY_CHECK_GOTO(ret = lydxml_data_skip(xmlctx), cleanup);
                 continue;
@@ -467,29 +445,30 @@
         if (mod && (!parent || parent->schema)) {
             snode = lys_find_child(parent ? parent->schema : NULL, mod, name, name_len, 0, getnext_opts);
             if (!snode) {
-                if (lydctx->options & LYD_PARSE_STRICT) {
+                if (lydctx->parse_options & LYD_PARSE_STRICT) {
                     LOGVAL(ctx, LY_VLOG_LINE, &xmlctx->line, LYVE_REFERENCE, "Element \"%.*s\" not found in the \"%s\" module.",
                         name_len, name, mod->name);
                     ret = LY_EVALID;
                     goto cleanup;
-                } else if (!(lydctx->options & LYD_PARSE_OPAQ)) {
+                } else if (!(lydctx->parse_options & LYD_PARSE_OPAQ)) {
                     /* skip element with children */
                     LY_CHECK_GOTO(ret = lydxml_data_skip(xmlctx), cleanup);
                     continue;
                 }
             } else {
                 /* check that schema node is valid and can be used */
-                LY_CHECK_GOTO(ret = lydxml_data_check_schema(lydctx, &snode), cleanup);
+                LY_CHECK_GOTO(ret = lyd_parser_check_schema((struct lyd_ctx *)lydctx, snode), cleanup);
+                LY_CHECK_GOTO(ret = lydxml_data_check_opaq(lydctx, &snode), cleanup);
             }
         }
 
         /* create metadata/attributes */
         if (xmlctx->status == LYXML_ATTRIBUTE) {
             if (snode) {
-                ret = lydxml_metadata(xmlctx, snode, lydctx->options & LYD_PARSE_STRICT, &lydctx->unres_meta_type, &meta);
+                ret = lydxml_metadata(lydctx, snode, &meta);
                 LY_CHECK_GOTO(ret, cleanup);
             } else {
-                assert(lydctx->options & LYD_PARSE_OPAQ);
+                assert(lydctx->parse_options & LYD_PARSE_OPAQ);
                 ret = lydxml_attrs(xmlctx, &attr);
                 LY_CHECK_GOTO(ret, cleanup);
             }
@@ -497,7 +476,7 @@
 
         assert(xmlctx->status == LYXML_ELEM_CONTENT);
         if (!snode) {
-            assert(lydctx->options & LYD_PARSE_OPAQ);
+            assert(lydctx->parse_options & LYD_PARSE_OPAQ);
 
             if (xmlctx->ws_only) {
                 /* ignore WS-only value */
@@ -510,8 +489,8 @@
             }
 
             /* create node */
-            ret = lyd_create_opaq(ctx, name, name_len, xmlctx->value, xmlctx->value_len, &xmlctx->dynamic, LYD_XML,
-                                  val_prefs, prefix, prefix_len, ns->uri, &cur);
+            ret = lyd_create_opaq(ctx, name, name_len, xmlctx->value, xmlctx->value_len, &xmlctx->dynamic, 0, LYD_XML,
+                                  val_prefs, prefix, prefix_len, ns->uri, strlen(ns->uri), &cur);
             LY_CHECK_GOTO(ret, cleanup);
 
             /* parser next */
@@ -524,21 +503,14 @@
             }
         } else if (snode->nodetype & LYD_NODE_TERM) {
             /* create node */
-            ret = lyd_create_term(snode, xmlctx->value, xmlctx->value_len, &xmlctx->dynamic, lydxml_resolve_prefix,
-                                  xmlctx, LYD_XML, &cur);
-            if (ret == LY_EINCOMPLETE) {
-                if (!(lydctx->options & LYD_PARSE_ONLY)) {
-                    ly_set_add(&lydctx->unres_node_type, cur, LY_SET_OPT_USEASLIST);
-                }
-            } else if (ret) {
-                goto cleanup;
-            }
+            LY_CHECK_GOTO(ret = lyd_parser_create_term((struct lyd_ctx*)lydctx, snode, xmlctx->value, xmlctx->value_len, &xmlctx->dynamic, 0,
+                                                       lydxml_resolve_prefix, xmlctx, LYD_XML, &cur), cleanup);
 
             if (parent && (cur->schema->flags & LYS_KEY)) {
                 /* check the key order, the anchor must never be a key */
                 anchor = lyd_insert_get_next_anchor(parent->child, cur);
                 if (anchor && (anchor->schema->flags & LYS_KEY)) {
-                    if (lydctx->options & LYD_PARSE_STRICT) {
+                    if (lydctx->parse_options & LYD_PARSE_STRICT) {
                         LOGVAL(ctx, LY_VLOG_LINE, &xmlctx->line, LYVE_DATA, "Invalid position of the key \"%s\" in a list.",
                                 cur->schema->name);
                         ret = LY_EVALID;
@@ -586,21 +558,20 @@
                 LY_CHECK_GOTO(ret = lyd_parse_check_keys(cur), cleanup);
             }
 
-            if (!(lydctx->options & LYD_PARSE_ONLY)) {
+            if (!(lydctx->parse_options & LYD_PARSE_ONLY)) {
                 /* new node validation, autodelete CANNOT occur, all nodes are new */
                 ret = lyd_validate_new(lyd_node_children_p(cur), snode, NULL, NULL);
                 LY_CHECK_GOTO(ret, cleanup);
 
                 /* add any missing default children */
-                ret = lyd_new_implicit_r(cur, lyd_node_children_p(cur), NULL, NULL, &lydctx->unres_node_type,
-                                         &lydctx->when_check, (lydctx->options & LYD_VALIDATE_NO_STATE)
-                                            ? LYD_IMPLICIT_NO_STATE : 0, NULL);
+                ret = lyd_new_implicit_r(cur, lyd_node_children_p(cur), NULL, NULL, &lydctx->unres_node_type, &lydctx->when_check,
+                                         (lydctx->validate_options & LYD_VALIDATE_NO_STATE) ? LYD_IMPLICIT_NO_STATE : 0, NULL);
                 LY_CHECK_GOTO(ret, cleanup);
             }
 
             if (snode->nodetype & (LYS_RPC | LYS_ACTION | LYS_NOTIF)) {
                 /* rememeber the RPC/action/notification */
-                lydctx->op_ntf = cur;
+                lydctx->op_node = cur;
             }
         } else if (snode->nodetype & LYD_NODE_ANY) {
             if (!xmlctx->ws_only) {
@@ -615,12 +586,12 @@
             LY_CHECK_GOTO(ret = lyxml_ctx_next(xmlctx), cleanup);
 
             /* parse any data tree with correct options */
-            prev_opts = lydctx->options;
-            lydctx->options &= ~LYD_PARSE_STRICT;
-            lydctx->options |= LYD_PARSE_OPAQ;
+            prev_opts = lydctx->parse_options;
+            lydctx->parse_options &= ~LYD_PARSE_STRICT;
+            lydctx->parse_options |= LYD_PARSE_OPAQ;
             anchor = NULL;
             ret = lydxml_data_r(lydctx, NULL, &anchor);
-            lydctx->options = prev_opts;
+            lydctx->parse_options = prev_opts;
             LY_CHECK_GOTO(ret, cleanup);
 
             /* create node */
@@ -631,7 +602,7 @@
 
         /* add/correct flags */
         if (snode) {
-            lyd_parse_set_data_flags(cur, &lydctx->when_check, &meta, lydctx->options);
+            lyd_parse_set_data_flags(cur, &lydctx->when_check, &meta, lydctx->parse_options);
         }
 
         /* add metadata/attributes */
@@ -677,73 +648,37 @@
 }
 
 LY_ERR
-lyd_parse_xml_data(const struct ly_ctx *ctx, struct ly_in *in, int parse_options, int validate_options, struct lyd_node **tree)
+lyd_parse_xml_data(const struct ly_ctx *ctx, struct ly_in *in, int parse_options, int validate_options, struct lyd_node **tree_p, struct lyd_ctx **lydctx_p)
 {
     LY_ERR ret = LY_SUCCESS;
-    struct lyd_xml_ctx lydctx = {0};
-    uint32_t i = 0;
-    const struct lys_module *mod;
-    struct lyd_node *first, *next, **first2;
+    struct lyd_xml_ctx *lydctx;
 
     assert(!(parse_options & ~LYD_PARSE_OPTS_MASK));
     assert(!(validate_options & ~LYD_VALIDATE_OPTS_MASK));
 
-    /* init context and tree */
-    LY_CHECK_GOTO(ret = lyxml_ctx_new(ctx, in, &lydctx.xmlctx), cleanup);
-    lydctx.options = parse_options;
-    *tree = NULL;
+    /* init context */
+    lydctx = calloc(1, sizeof *lydctx);
+    LY_CHECK_ERR_RET(!lydctx, LOGMEM(ctx), LY_EMEM);
+    LY_CHECK_GOTO(ret = lyxml_ctx_new(ctx, in, &lydctx->xmlctx), cleanup);
+    lydctx->parse_options = parse_options;
+    lydctx->validate_options = validate_options;
+    lydctx->free = lyd_xml_ctx_free;
+    lydctx->resolve_prefix = lydxml_resolve_prefix;
 
     /* parse XML data */
-    LY_CHECK_GOTO(ret = lydxml_data_r(&lydctx, NULL, tree), cleanup);
-
-    if (!(parse_options & LYD_PARSE_ONLY)) {
-        next = *tree;
-        while (1) {
-            if (validate_options & LYD_VALIDATE_PRESENT) {
-                mod = lyd_data_next_module(&next, &first);
-            } else {
-                mod = lyd_mod_next_module(next, NULL, ctx, &i, &first);
-            }
-            if (!mod) {
-                break;
-            }
-            if (first == *tree) {
-                /* make sure first2 changes are carried to tree */
-                first2 = tree;
-            } else {
-                first2 = &first;
-            }
-
-            /* validate new top-level nodes, autodelete CANNOT occur, all nodes are new */
-            LY_CHECK_GOTO(ret = lyd_validate_new(first2, NULL, mod, NULL), cleanup);
-
-            /* add all top-level defaults for this module */
-            ret = lyd_new_implicit_r(NULL, first2, NULL, mod, &lydctx.unres_node_type, &lydctx.when_check,
-                                     validate_options & LYD_VALIDATE_NO_STATE ? LYD_IMPLICIT_NO_STATE : 0, NULL);
-            LY_CHECK_GOTO(ret, cleanup);
-
-            /* finish incompletely validated terminal values/attributes and when conditions */
-            ret = lyd_validate_unres(tree, &lydctx.when_check, &lydctx.unres_node_type, &lydctx.unres_meta_type, LYD_XML,
-                                     lydxml_resolve_prefix, lydctx.xmlctx, NULL);
-            LY_CHECK_GOTO(ret, cleanup);
-
-            /* perform final validation that assumes the data tree is final */
-            LY_CHECK_GOTO(ret = lyd_validate_final_r(*first2, NULL, mod, validate_options, 0), cleanup);
-        }
-    }
+    LY_CHECK_GOTO(ret = lydxml_data_r(lydctx, NULL, tree_p), cleanup);
 
 cleanup:
     /* there should be no unresolved types stored */
-    assert(!(parse_options & LYD_PARSE_ONLY) || (!lydctx.unres_node_type.count && !lydctx.unres_meta_type.count
-           && !lydctx.when_check.count));
+    assert(!(parse_options & LYD_PARSE_ONLY) || (!lydctx->unres_node_type.count && !lydctx->unres_meta_type.count
+           && !lydctx->when_check.count));
 
-    ly_set_erase(&lydctx.unres_node_type, NULL);
-    ly_set_erase(&lydctx.unres_meta_type, NULL);
-    ly_set_erase(&lydctx.when_check, NULL);
-    lyxml_ctx_free(lydctx.xmlctx);
     if (ret) {
-        lyd_free_all(*tree);
-        *tree = NULL;
+        lyd_xml_ctx_free((struct lyd_ctx *)lydctx);
+        lyd_free_all(*tree_p);
+        *tree_p = NULL;
+    } else {
+        *lydctx_p = (struct lyd_ctx *)lydctx;
     }
     return ret;
 }
@@ -753,7 +688,7 @@
 {
     LY_ERR ret = LY_SUCCESS;
     const struct lyxml_ns *ns = NULL;
-    struct ly_attr *attr = NULL;
+    struct lyd_attr *attr = NULL;
     const char *prefix;
     size_t prefix_len;
 
@@ -795,7 +730,8 @@
     LY_CHECK_GOTO(ret = lyxml_ctx_next(xmlctx), cleanup);
 
     /* create node */
-    ret = lyd_create_opaq(xmlctx->ctx, name, strlen(name), "", 0, NULL, LYD_XML, NULL, prefix, prefix_len, uri, envp);
+    ret = lyd_create_opaq(xmlctx->ctx, name, strlen(name), "", 0, NULL, 0, LYD_XML, NULL, prefix, prefix_len,
+                          uri, strlen(uri), envp);
     LY_CHECK_GOTO(ret, cleanup);
 
     /* assign atributes */
@@ -808,20 +744,17 @@
 }
 
 LY_ERR
-lyd_parse_xml_rpc(const struct ly_ctx *ctx, struct ly_in *in, struct lyd_node **tree, struct lyd_node **op)
+lyd_parse_xml_rpc(const struct ly_ctx *ctx, struct ly_in *in, struct lyd_node **tree_p, struct lyd_node **op_p)
 {
     LY_ERR ret = LY_SUCCESS;
     struct lyd_xml_ctx lydctx = {0};
     struct lyd_node *rpc_e = NULL, *act_e = NULL;
+    struct lyd_node *tree = NULL;
 
     /* init */
     LY_CHECK_GOTO(ret = lyxml_ctx_new(ctx, in, &lydctx.xmlctx), cleanup);
-    lydctx.options = LYD_PARSE_ONLY | LYD_PARSE_STRICT;
+    lydctx.parse_options = LYD_PARSE_ONLY | LYD_PARSE_STRICT;
     lydctx.int_opts = LYD_INTOPT_RPC;
-    *tree = NULL;
-    if (op) {
-        *op = NULL;
-    }
 
     /* parse "rpc", if any */
     LY_CHECK_GOTO(ret = lydxml_envelope(lydctx.xmlctx, "rpc", "urn:ietf:params:xml:ns:netconf:base:1.0", &rpc_e), cleanup);
@@ -832,10 +765,10 @@
     }
 
     /* parse the rest of data normally */
-    LY_CHECK_GOTO(ret = lydxml_data_r(&lydctx, NULL, tree), cleanup);
+    LY_CHECK_GOTO(ret = lydxml_data_r(&lydctx, NULL, &tree), cleanup);
 
     /* make sure we have parsed some operation */
-    if (!lydctx.op_ntf) {
+    if (!lydctx.op_node) {
         LOGVAL(ctx, LY_VLOG_NONE, NULL, LYVE_DATA, "Missing the \"rpc\"/\"action\" node.");
         ret = LY_EVALID;
         goto cleanup;
@@ -849,9 +782,9 @@
                    lydctx.xmlctx->name_len, lydctx.xmlctx->name);
             ret = LY_EVALID;
             goto cleanup;
-        } else if (lydctx.op_ntf->schema->nodetype != LYS_ACTION) {
-            LOGVAL(ctx, LY_VLOG_LYD, lydctx.op_ntf, LYVE_DATA, "Unexpected %s element, an \"action\" expected.",
-                   lys_nodetype2str(lydctx.op_ntf->schema->nodetype));
+        } else if (lydctx.op_node->schema->nodetype != LYS_ACTION) {
+            LOGVAL(ctx, LY_VLOG_LYD, lydctx.op_node, LYVE_DATA, "Unexpected %s element, an \"action\" expected.",
+                   lys_nodetype2str(lydctx.op_node->schema->nodetype));
             ret = LY_EVALID;
             goto cleanup;
         }
@@ -864,28 +797,35 @@
                    lydctx.xmlctx->name_len, lydctx.xmlctx->name);
             ret = LY_EVALID;
             goto cleanup;
-        } else if (!act_e && (lydctx.op_ntf->schema->nodetype != LYS_RPC)) {
-            LOGVAL(ctx, LY_VLOG_LYD, lydctx.op_ntf, LYVE_DATA, "Unexpected %s element, an \"rpc\" expected.",
-                   lys_nodetype2str(lydctx.op_ntf->schema->nodetype));
+        } else if (!act_e && (lydctx.op_node->schema->nodetype != LYS_RPC)) {
+            LOGVAL(ctx, LY_VLOG_LYD, lydctx.op_node, LYVE_DATA, "Unexpected %s element, an \"rpc\" expected.",
+                   lys_nodetype2str(lydctx.op_node->schema->nodetype));
             ret = LY_EVALID;
             goto cleanup;
         }
         LY_CHECK_GOTO(ret = lyxml_ctx_next(lydctx.xmlctx), cleanup);
     }
 
-    if (op) {
-        *op = lydctx.op_ntf;
+    if (op_p) {
+        *op_p = lydctx.op_node;
     }
-    assert(*tree);
+    assert(tree);
+    if (tree_p) {
+        *tree_p = tree;
+    }
     if (act_e) {
         /* connect to the action */
-        lyd_insert_node(act_e, NULL, *tree);
-        *tree = act_e;
+        lyd_insert_node(act_e, NULL, *tree_p);
+        if (tree_p) {
+            *tree_p = act_e;
+        }
     }
     if (rpc_e) {
         /* connect to the rpc */
-        lyd_insert_node(rpc_e, NULL, *tree);
-        *tree = rpc_e;
+        lyd_insert_node(rpc_e, NULL, *tree_p);
+        if (tree_p) {
+            *tree_p = rpc_e;
+        }
     }
 
 cleanup:
@@ -893,10 +833,9 @@
     assert(!lydctx.unres_node_type.count && !lydctx.unres_meta_type.count && !lydctx.when_check.count);
     lyxml_ctx_free(lydctx.xmlctx);
     if (ret) {
-        lyd_free_all(*tree);
+        lyd_free_all(tree);
         lyd_free_tree(act_e);
         lyd_free_tree(rpc_e);
-        *tree = NULL;
     }
     return ret;
 }
@@ -906,7 +845,7 @@
 {
     LY_ERR ret = LY_SUCCESS;
     const struct lyxml_ns *ns = NULL;
-    struct ly_attr *attr = NULL;
+    struct lyd_attr *attr = NULL;
     struct lyd_node *et;
     const char *prefix;
     size_t prefix_len;
@@ -961,8 +900,8 @@
     }*/
 
     /* create node */
-    ret = lyd_create_opaq(xmlctx->ctx, "eventTime", 9, xmlctx->value, xmlctx->value_len, NULL, LYD_XML, NULL,
-                          prefix, prefix_len, ns->uri, &et);
+    ret = lyd_create_opaq(xmlctx->ctx, "eventTime", 9, xmlctx->value, xmlctx->value_len, NULL, 0, LYD_XML, NULL,
+                          prefix, prefix_len, ns->uri, strlen(ns->uri), &et);
     LY_CHECK_GOTO(ret, cleanup);
 
     /* assign atributes */
@@ -992,29 +931,26 @@
 }
 
 LY_ERR
-lyd_parse_xml_notif(const struct ly_ctx *ctx, struct ly_in *in, struct lyd_node **tree, struct lyd_node **ntf)
+lyd_parse_xml_notif(const struct ly_ctx *ctx, struct ly_in *in, struct lyd_node **tree_p, struct lyd_node **ntf_p)
 {
     LY_ERR ret = LY_SUCCESS;
     struct lyd_xml_ctx lydctx = {0};
     struct lyd_node *ntf_e = NULL;
+    struct lyd_node *tree = NULL;
 
     /* init */
     LY_CHECK_GOTO(ret = lyxml_ctx_new(ctx, in, &lydctx.xmlctx), cleanup);
-    lydctx.options = LYD_PARSE_ONLY | LYD_PARSE_STRICT;
+    lydctx.parse_options = LYD_PARSE_ONLY | LYD_PARSE_STRICT;
     lydctx.int_opts = LYD_INTOPT_NOTIF;
-    *tree = NULL;
-    if (ntf) {
-        *ntf = NULL;
-    }
 
     /* parse "notification" and "eventTime", if present */
     LY_CHECK_GOTO(ret = lydxml_notif_envelope(lydctx.xmlctx, &ntf_e), cleanup);
 
     /* parse the rest of data normally */
-    LY_CHECK_GOTO(ret = lydxml_data_r(&lydctx, NULL, tree), cleanup);
+    LY_CHECK_GOTO(ret = lydxml_data_r(&lydctx, NULL, &tree), cleanup);
 
     /* make sure we have parsed some notification */
-    if (!lydctx.op_ntf) {
+    if (!lydctx.op_node) {
         LOGVAL(ctx, LY_VLOG_NONE, NULL, LYVE_DATA, "Missing the \"notification\" node.");
         ret = LY_EVALID;
         goto cleanup;
@@ -1032,14 +968,19 @@
         LY_CHECK_GOTO(ret = lyxml_ctx_next(lydctx.xmlctx), cleanup);
     }
 
-    if (ntf) {
-        *ntf = lydctx.op_ntf;
+    if (ntf_p) {
+        *ntf_p = lydctx.op_node;
     }
-    assert(*tree);
+    assert(tree);
+    if (tree_p) {
+        *tree_p = tree;
+    }
     if (ntf_e) {
         /* connect to the notification */
-        lyd_insert_node(ntf_e, NULL, *tree);
-        *tree = ntf_e;
+        lyd_insert_node(ntf_e, NULL, *tree_p);
+        if (tree_p) {
+            *tree_p = ntf_e;
+        }
     }
 
 cleanup:
@@ -1047,15 +988,14 @@
     assert(!lydctx.unres_node_type.count && !lydctx.unres_meta_type.count && !lydctx.when_check.count);
     lyxml_ctx_free(lydctx.xmlctx);
     if (ret) {
-        lyd_free_all(*tree);
+        lyd_free_all(tree);
         lyd_free_tree(ntf_e);
-        *tree = NULL;
     }
     return ret;
 }
 
 LY_ERR
-lyd_parse_xml_reply(const struct lyd_node *request, struct ly_in *in, struct lyd_node **tree, struct lyd_node **op)
+lyd_parse_xml_reply(const struct lyd_node *request, struct ly_in *in, struct lyd_node **tree_p, struct lyd_node **op_p)
 {
     LY_ERR ret = LY_SUCCESS;
     struct lyd_xml_ctx lydctx = {0};
@@ -1063,12 +1003,8 @@
 
     /* init */
     LY_CHECK_GOTO(ret = lyxml_ctx_new(LYD_NODE_CTX(request), in, &lydctx.xmlctx), cleanup);
-    lydctx.options = LYD_PARSE_ONLY | LYD_PARSE_STRICT;
+    lydctx.parse_options = LYD_PARSE_ONLY | LYD_PARSE_STRICT;
     lydctx.int_opts = LYD_INTOPT_REPLY;
-    *tree = NULL;
-    if (op) {
-        *op = NULL;
-    }
 
     /* find request OP */
     LYD_TREE_DFS_BEGIN((struct lyd_node *)request, req_op) {
@@ -1105,15 +1041,19 @@
         LY_CHECK_GOTO(ret = lyxml_ctx_next(lydctx.xmlctx), cleanup);
     }
 
-    if (op) {
-        *op = rep_op;
+    if (op_p) {
+        *op_p = rep_op;
     }
     for (iter = rep_op; iter->parent; iter = (struct lyd_node *)iter->parent);
-    *tree = iter;
+    if (tree_p) {
+        *tree_p = iter;
+    }
     if (rpcr_e) {
         /* connect to the operation */
-        lyd_insert_node(rpcr_e, NULL, *tree);
-        *tree = rpcr_e;
+        lyd_insert_node(rpcr_e, NULL, *tree_p);
+        if (tree_p) {
+            *tree_p = rpcr_e;
+        }
     }
 
 cleanup:
diff --git a/src/path.c b/src/path.c
index 3a299ae..5f30e94 100644
--- a/src/path.c
+++ b/src/path.c
@@ -364,7 +364,7 @@
 static LY_ERR
 ly_path_compile_prefix(const struct ly_ctx *ctx, const struct lysc_node *cur_node, const struct lys_module *cur_mod,
                        const struct lysc_node *prev_ctx_node, const struct lyxp_expr *expr, uint16_t tok_idx,
-                       uint8_t lref, ly_clb_resolve_prefix resolve_prefix, void *prefix_data, LYD_FORMAT format,
+                       uint8_t lref, ly_resolve_prefix_clb resolve_prefix, void *prefix_data, LYD_FORMAT format,
                        const struct lys_module **mod, const char **name, size_t *name_len)
 {
     const char *ptr;
@@ -423,7 +423,7 @@
 LY_ERR
 ly_path_compile_predicate(const struct ly_ctx *ctx, const struct lysc_node *cur_node, const struct lys_module *cur_mod,
                           const struct lysc_node *ctx_node, const struct lyxp_expr *expr, uint16_t *tok_idx,
-                          ly_clb_resolve_prefix resolve_prefix, void *prefix_data, LYD_FORMAT format,
+                          ly_resolve_prefix_clb resolve_prefix, void *prefix_data, LYD_FORMAT format,
                           struct ly_path_predicate **predicates, enum ly_path_pred_type *pred_type)
 {
     struct ly_path_predicate *p;
@@ -574,7 +574,7 @@
  */
 static LY_ERR
 ly_path_compile_predicate_leafref(const struct lysc_node *ctx_node, const struct lysc_node *cur_node,
-                                  const struct lyxp_expr *expr, uint16_t *tok_idx, ly_clb_resolve_prefix resolve_prefix,
+                                  const struct lyxp_expr *expr, uint16_t *tok_idx, ly_resolve_prefix_clb resolve_prefix,
                                   void *prefix_data, LYD_FORMAT format)
 {
     const struct lysc_node *key, *node, *node2;
@@ -694,7 +694,7 @@
 LY_ERR
 ly_path_compile(const struct ly_ctx *ctx, const struct lys_module *cur_mod, const struct lysc_node *ctx_node,
                 const struct lyxp_expr *expr, uint8_t lref, uint8_t oper, uint8_t target,
-                ly_clb_resolve_prefix resolve_prefix, void *prefix_data, LYD_FORMAT format, struct ly_path **path)
+                ly_resolve_prefix_clb resolve_prefix, void *prefix_data, LYD_FORMAT format, struct ly_path **path)
 {
     LY_ERR ret = LY_SUCCESS;
     uint16_t tok_idx = 0;
diff --git a/src/path.h b/src/path.h
index 80085a6..9faa0e1 100644
--- a/src/path.h
+++ b/src/path.h
@@ -160,7 +160,7 @@
  */
 LY_ERR ly_path_compile(const struct ly_ctx *ctx, const struct lys_module *cur_mod, const struct lysc_node *ctx_node,
                        const struct lyxp_expr *expr, uint8_t lref, uint8_t oper, uint8_t target,
-                       ly_clb_resolve_prefix resolve_prefix, void *prefix_data, LYD_FORMAT format, struct ly_path **path);
+                       ly_resolve_prefix_clb resolve_prefix, void *prefix_data, LYD_FORMAT format, struct ly_path **path);
 
 /**
  * @brief Compile predicate into ly_path_predicate structure. Only simple predicates (not leafref) are supported.
@@ -180,7 +180,7 @@
  */
 LY_ERR ly_path_compile_predicate(const struct ly_ctx *ctx, const struct lysc_node *cur_node, const struct lys_module *cur_mod,
                                  const struct lysc_node *ctx_node, const struct lyxp_expr *expr, uint16_t *tok_idx,
-                                 ly_clb_resolve_prefix resolve_prefix, void *prefix_data, LYD_FORMAT format,
+                                 ly_resolve_prefix_clb resolve_prefix, void *prefix_data, LYD_FORMAT format,
                                  struct ly_path_predicate **predicates, enum ly_path_pred_type *pred_type);
 
 /**
diff --git a/src/plugins_types.c b/src/plugins_types.c
index 2b64a20..e6e4e36 100644
--- a/src/plugins_types.c
+++ b/src/plugins_types.c
@@ -57,7 +57,7 @@
  */
 static const char *
 ly_type_print_canonical(const struct lyd_value *value, LYD_FORMAT UNUSED(format),
-                        ly_clb_get_prefix UNUSED(get_prefix), void *UNUSED(printer), int *dynamic)
+                        ly_get_prefix_clb UNUSED(get_prefix), void *UNUSED(printer), int *dynamic)
 {
     *dynamic = 0;
     return (char*)value->canonical_cache;
@@ -161,7 +161,7 @@
 }
 
 API struct lyd_value_prefix *
-ly_type_get_prefixes(const struct ly_ctx *ctx, const char *value, size_t value_len, ly_clb_resolve_prefix resolve_prefix,
+ly_type_get_prefixes(const struct ly_ctx *ctx, const char *value, size_t value_len, ly_resolve_prefix_clb resolve_prefix,
                      void *parser)
 {
     LY_ERR ret;
@@ -524,7 +524,7 @@
  */
 static LY_ERR
 ly_type_store_int(const struct ly_ctx *ctx, struct lysc_type *type, const char *value, size_t value_len, int options,
-                  ly_clb_resolve_prefix UNUSED(resolve_prefix), void *UNUSED(parser), LYD_FORMAT UNUSED(format),
+                  ly_resolve_prefix_clb UNUSED(resolve_prefix), void *UNUSED(parser), LYD_FORMAT UNUSED(format),
                   const void *UNUSED(context_node), const struct lyd_node *UNUSED(tree),
                   struct lyd_value *storage, const char **canonized, struct ly_err_item **err)
 {
@@ -599,7 +599,7 @@
  */
 static LY_ERR
 ly_type_store_uint(const struct ly_ctx *ctx, struct lysc_type *type, const char *value, size_t value_len, int options,
-                   ly_clb_resolve_prefix UNUSED(resolve_prefix), void *UNUSED(parser), LYD_FORMAT UNUSED(format),
+                   ly_resolve_prefix_clb UNUSED(resolve_prefix), void *UNUSED(parser), LYD_FORMAT UNUSED(format),
                    const void *UNUSED(context_node), const struct lyd_node *UNUSED(tree),
                    struct lyd_value *storage, const char **canonized, struct ly_err_item **err)
 {
@@ -673,7 +673,7 @@
  */
 static LY_ERR
 ly_type_store_decimal64(const struct ly_ctx *ctx, struct lysc_type *type, const char *value, size_t value_len, int options,
-                        ly_clb_resolve_prefix UNUSED(resolve_prefix), void *UNUSED(parser), LYD_FORMAT UNUSED(format),
+                        ly_resolve_prefix_clb UNUSED(resolve_prefix), void *UNUSED(parser), LYD_FORMAT UNUSED(format),
                         const void *UNUSED(context_node), const struct lyd_node *UNUSED(tree),
                         struct lyd_value *storage, const char **canonized, struct ly_err_item **err)
 {
@@ -757,7 +757,7 @@
  */
 static LY_ERR
 ly_type_store_binary(const struct ly_ctx *ctx, struct lysc_type *type, const char *value, size_t value_len, int options,
-                     ly_clb_resolve_prefix UNUSED(resolve_prefix), void *UNUSED(parser), LYD_FORMAT UNUSED(format),
+                     ly_resolve_prefix_clb UNUSED(resolve_prefix), void *UNUSED(parser), LYD_FORMAT UNUSED(format),
                      const void *UNUSED(context_node), const struct lyd_node *UNUSED(tree),
                      struct lyd_value *storage, const char **canonized, struct ly_err_item **err)
 {
@@ -867,7 +867,7 @@
  */
 static LY_ERR
 ly_type_store_string(const struct ly_ctx *ctx, struct lysc_type *type, const char *value, size_t value_len, int options,
-                     ly_clb_resolve_prefix UNUSED(resolve_prefix), void *UNUSED(parser), LYD_FORMAT UNUSED(format),
+                     ly_resolve_prefix_clb UNUSED(resolve_prefix), void *UNUSED(parser), LYD_FORMAT UNUSED(format),
                      const void *UNUSED(context_node), const struct lyd_node *UNUSED(tree),
                      struct lyd_value *storage, const char **canonized, struct ly_err_item **err)
 {
@@ -911,7 +911,7 @@
  */
 static LY_ERR
 ly_type_store_bits(const struct ly_ctx *ctx, struct lysc_type *type, const char *value, size_t value_len, int options,
-                   ly_clb_resolve_prefix UNUSED(resolve_prefix), void *UNUSED(parser), LYD_FORMAT UNUSED(format),
+                   ly_resolve_prefix_clb UNUSED(resolve_prefix), void *UNUSED(parser), LYD_FORMAT UNUSED(format),
                    const void *UNUSED(context_node), const struct lyd_node *UNUSED(tree),
                    struct lyd_value *storage, const char **canonized, struct ly_err_item **err)
 {
@@ -1100,7 +1100,7 @@
  */
 static LY_ERR
 ly_type_store_enum(const struct ly_ctx *ctx, struct lysc_type *type, const char *value, size_t value_len, int options,
-                   ly_clb_resolve_prefix UNUSED(resolve_prefix), void *UNUSED(parser), LYD_FORMAT UNUSED(format),
+                   ly_resolve_prefix_clb UNUSED(resolve_prefix), void *UNUSED(parser), LYD_FORMAT UNUSED(format),
                    const void *UNUSED(context_node), const struct lyd_node *UNUSED(tree),
                    struct lyd_value *storage, const char **canonized, struct ly_err_item **err)
 {
@@ -1180,7 +1180,7 @@
  */
 static LY_ERR
 ly_type_store_boolean(const struct ly_ctx *ctx, struct lysc_type *UNUSED(type), const char *value, size_t value_len, int options,
-                      ly_clb_resolve_prefix UNUSED(resolve_prefix), void *UNUSED(parser), LYD_FORMAT UNUSED(format),
+                      ly_resolve_prefix_clb UNUSED(resolve_prefix), void *UNUSED(parser), LYD_FORMAT UNUSED(format),
                       const void *UNUSED(context_node), const struct lyd_node *UNUSED(tree),
                       struct lyd_value *storage, const char **canonized, struct ly_err_item **err)
 {
@@ -1240,7 +1240,7 @@
  */
 static LY_ERR
 ly_type_store_empty(const struct ly_ctx *ctx, struct lysc_type *UNUSED(type), const char *value, size_t value_len, int options,
-                    ly_clb_resolve_prefix UNUSED(resolve_prefix), void *UNUSED(parser), LYD_FORMAT UNUSED(format),
+                    ly_resolve_prefix_clb UNUSED(resolve_prefix), void *UNUSED(parser), LYD_FORMAT UNUSED(format),
                     const void *UNUSED(context_node), const struct lyd_node *UNUSED(tree),
                     struct lyd_value *storage, const char **canonized, struct ly_err_item **err)
 {
@@ -1305,7 +1305,7 @@
  */
 static LY_ERR
 ly_type_store_identityref(const struct ly_ctx *ctx, struct lysc_type *type, const char *value, size_t value_len, int options,
-                          ly_clb_resolve_prefix resolve_prefix, void *parser, LYD_FORMAT UNUSED(format),
+                          ly_resolve_prefix_clb resolve_prefix, void *parser, LYD_FORMAT UNUSED(format),
                           const void *UNUSED(context_node), const struct lyd_node *UNUSED(tree),
                           struct lyd_value *storage, const char **canonized, struct ly_err_item **err)
 {
@@ -1426,7 +1426,7 @@
  * Implementation of the ly_type_print_clb.
  */
 static const char *
-ly_type_print_identityref(const struct lyd_value *value, LYD_FORMAT UNUSED(format), ly_clb_get_prefix get_prefix, void *printer, int *dynamic)
+ly_type_print_identityref(const struct lyd_value *value, LYD_FORMAT UNUSED(format), ly_get_prefix_clb get_prefix, void *printer, int *dynamic)
 {
     char *result = NULL;
 
@@ -1453,7 +1453,7 @@
  * @brief Helper function for ly_type_store_instanceid_parse_predicate_value() to provide prefix mapping for the
  * validation callbacks for the values used in instance-identifier predicates.
  *
- * Implementation of the ly_clb_resolve_prefix.
+ * Implementation of the ly_resolve_prefix_clb.
  */
 static const struct lys_module *
 ly_type_stored_prefixes_clb(const struct ly_ctx *UNUSED(ctx), const char *prefix, size_t prefix_len, void *private)
@@ -1476,7 +1476,7 @@
  */
 static LY_ERR
 ly_type_store_instanceid(const struct ly_ctx *ctx, struct lysc_type *type, const char *value, size_t value_len, int options,
-                         ly_clb_resolve_prefix resolve_prefix, void *parser, LYD_FORMAT format,
+                         ly_resolve_prefix_clb resolve_prefix, void *parser, LYD_FORMAT format,
                          const void *context_node, const struct lyd_node *tree, struct lyd_value *storage,
                          const char **canonized, struct ly_err_item **err)
 {
@@ -1490,6 +1490,7 @@
     struct lyxp_expr *exp = NULL;
     const struct lysc_node *ctx_scnode;
     int erc = 0;
+    int prefix_opt = 0;
 
     /* init */
     *err = NULL;
@@ -1504,6 +1505,17 @@
         goto cleanup;
     }
 
+    switch (format) {
+    case LYD_SCHEMA:
+    case LYD_XML:
+        prefix_opt = LY_PATH_PREFIX_MANDATORY;
+        break;
+    case LYD_JSON:
+    case LYD_LYB:
+        prefix_opt = LY_PATH_PREFIX_STRICT_INHERIT;
+        break;
+    }
+
     if (!(options & LY_TYPE_OPTS_SCHEMA) && (options & LY_TYPE_OPTS_SECOND_CALL) && (options & LY_TYPE_OPTS_STORE)) {
         /* the second run in data tree, the first one ended with LY_EINCOMPLETE, but we have prepared the target structure */
         if (ly_path_eval(storage->target, tree, NULL)) {
@@ -1528,7 +1540,7 @@
 
     /* parse the value */
     ret = ly_path_parse(ctx, ctx_scnode, value, value_len, LY_PATH_BEGIN_ABSOLUTE, LY_PATH_LREF_FALSE,
-                        LY_PATH_PREFIX_MANDATORY, LY_PATH_PRED_SIMPLE, &exp);
+                        prefix_opt, LY_PATH_PRED_SIMPLE, &exp);
     if (ret) {
         erc = asprintf(&errmsg, "Invalid instance-identifier \"%.*s\" value - syntax error.", (int)value_len, value);
         goto error;
@@ -1670,7 +1682,7 @@
  * Implementation of the ly_type_print_clb.
  */
 static const char *
-ly_type_print_instanceid(const struct lyd_value *value, LYD_FORMAT format, ly_clb_get_prefix get_prefix, void *printer,
+ly_type_print_instanceid(const struct lyd_value *value, LYD_FORMAT format, ly_get_prefix_clb get_prefix, void *printer,
                          int *dynamic)
 {
     LY_ARRAY_COUNT_TYPE u, v;
@@ -1882,7 +1894,7 @@
  */
 static LY_ERR
 ly_type_store_leafref(const struct ly_ctx *ctx, struct lysc_type *type, const char *value, size_t value_len, int options,
-                      ly_clb_resolve_prefix resolve_prefix, void *parser, LYD_FORMAT format,
+                      ly_resolve_prefix_clb resolve_prefix, void *parser, LYD_FORMAT format,
                       const void *context_node, const struct lyd_node *tree,
                       struct lyd_value *storage, const char **canonized, struct ly_err_item **err)
 {
@@ -1990,7 +2002,7 @@
  * Implementation of the ly_type_print_clb.
  */
 static const char *
-ly_type_print_leafref(const struct lyd_value *value, LYD_FORMAT format, ly_clb_get_prefix get_prefix, void *printer, int *dynamic)
+ly_type_print_leafref(const struct lyd_value *value, LYD_FORMAT format, ly_get_prefix_clb get_prefix, void *printer, int *dynamic)
 {
     return value->realtype->plugin->print(value, format, get_prefix, printer, dynamic);
 }
@@ -2023,13 +2035,62 @@
 }
 
 /**
+ * @brief Answer if the type is suitable for the parser's hit (if any) in the specified format
+ */
+LY_ERR
+type_check_parser_hint(LYD_FORMAT format, int hint, LY_DATA_TYPE type)
+{
+    if (format == LYD_JSON && hint) {
+        switch (type) {
+        case LY_TYPE_UINT8:
+        case LY_TYPE_UINT16:
+        case LY_TYPE_UINT32:
+        case LY_TYPE_INT8:
+        case LY_TYPE_INT16:
+        case LY_TYPE_INT32:
+            if (hint != LY_TYPE_OPTS_ISNUMBER) {
+                return LY_ENOT;
+            }
+            break;
+        case LY_TYPE_STRING:
+        case LY_TYPE_UINT64:
+        case LY_TYPE_INT64:
+        case LY_TYPE_DEC64:
+        case LY_TYPE_ENUM:
+        case LY_TYPE_BITS:
+        case LY_TYPE_BINARY:
+        case LY_TYPE_IDENT:
+        case LY_TYPE_INST:
+            if (hint != LY_TYPE_OPTS_ISSTRING) {
+                return LY_ENOT;
+            }
+            break;
+        case LY_TYPE_BOOL:
+            if (hint != LY_TYPE_OPTS_ISBOOLEAN) {
+                return LY_ENOT;
+            }
+            break;
+        case LY_TYPE_EMPTY:
+            if (hint != LY_TYPE_OPTS_ISEMPTY) {
+                return LY_ENOT;
+            }
+            break;
+        default:
+            LOGINT_RET(NULL);
+        }
+    }
+
+    return LY_SUCCESS;
+}
+
+/**
  * @brief Validate, canonize and store value of the YANG built-in union type.
  *
  * Implementation of the ly_type_store_clb.
  */
 static LY_ERR
 ly_type_store_union(const struct ly_ctx *ctx, struct lysc_type *type, const char *value, size_t value_len, int options,
-                    ly_clb_resolve_prefix resolve_prefix, void *parser, LYD_FORMAT format,
+                    ly_resolve_prefix_clb resolve_prefix, void *parser, LYD_FORMAT format,
                     const void *context_node, const struct lyd_node *tree,
                     struct lyd_value *storage, const char **canonized, struct ly_err_item **err)
 {
@@ -2070,11 +2131,19 @@
         /* store prefixes for later use */
         subvalue->prefixes = ly_type_get_prefixes(ctx, value, value_len, resolve_prefix, parser);
 
+        /* remember the hint options */
+        subvalue->parser_hint = options & LY_TYPE_PARSER_HINTS_MASK;
+
 search_subtype:
         /* use the first usable sybtype to store the value */
         LY_ARRAY_FOR(type_u->types, u) {
             subvalue->value->realtype = type_u->types[u];
 
+            if (type_check_parser_hint(format, subvalue->parser_hint, subvalue->value->realtype->basetype)) {
+                /* not a suitable type */
+                continue;
+            }
+
             /* turn logging off */
             prev_lo = ly_log_options(0);
             ret = type_u->types[u]->plugin->store(ctx, type_u->types[u], value, value_len, options & ~LY_TYPE_OPTS_DYNAMIC,
@@ -2154,7 +2223,7 @@
  * Implementation of the ly_type_print_clb.
  */
 static const char *
-ly_type_print_union(const struct lyd_value *value, LYD_FORMAT format, ly_clb_get_prefix get_prefix, void *printer, int *dynamic)
+ly_type_print_union(const struct lyd_value *value, LYD_FORMAT format, ly_get_prefix_clb get_prefix, void *printer, int *dynamic)
 {
     return value->subvalue->value->realtype->plugin->print(value->subvalue->value, format, get_prefix, printer, dynamic);
 }
diff --git a/src/plugins_types.h b/src/plugins_types.h
index 62d2d38..eaf449f 100644
--- a/src/plugins_types.h
+++ b/src/plugins_types.h
@@ -155,10 +155,19 @@
                                             can (e.g. store the canonical/auxiliary value if it is requested) and in the case of need to use
                                             data trees (checking require-instance), it returns LY_EINCOMPLETE.
                                             Caller is supposed to call such validation callback again later with complete data trees. */
-#define LY_TYPE_OPTS_SECOND_CALL 0x20  /**< Flag for the second call of the callback when the first call returns LY_EINCOMPLETE,
+#define LY_TYPE_OPTS_SECOND_CALL  0x20 /**< Flag for the second call of the callback when the first call returns LY_EINCOMPLETE,
                                             other options should be the same as for the first call. **!!** Note that this second call
                                             can occur even if the first call succeeded, in which case the plugin should immediately
                                             return LY_SUCCESS. */
+#define LY_TYPE_OPTS_ISSTRING     LYD_NODE_OPAQ_ISSTRING /**< Hint flag from the parser in case the source format provides some additional information
+                                            about the type of the data. The flag is expected to be used in combination with the format information. */
+#define LY_TYPE_OPTS_ISNUMBER     LYD_NODE_OPAQ_ISNUMBER /**< Hint flag from the parser in case the source format provides some additional information
+                                            about the type of the data. The flag is expected to be used in combination with the format information. */
+#define LY_TYPE_OPTS_ISBOOLEAN    LYD_NODE_OPAQ_ISBOOLEAN /**< Hint flag from the parser in case the source format provides some additional information
+                                            about the type of the data. The flag is expected to be used in combination with the format information. */
+#define LY_TYPE_OPTS_ISEMPTY      LYD_NODE_OPAQ_ISEMPTY /**< Hint flag from the parser in case the source format provides some additional information
+                                            about the type of the data. The flag is expected to be used in combination with the format information. */
+#define LY_TYPE_PARSER_HINTS_MASK (LY_TYPE_OPTS_ISSTRING | LY_TYPE_OPTS_ISNUMBER | LY_TYPE_OPTS_ISBOOLEAN | LY_TYPE_OPTS_ISEMPTY)
 
 /** @} plugintypeopts */
 
@@ -200,7 +209,7 @@
  * @return LY_ERR value if an error occurred and the value could not be canonized following the type's rules.
  */
 typedef LY_ERR (*ly_type_store_clb)(const struct ly_ctx *ctx, struct lysc_type *type, const char *value, size_t value_len,
-                                    int options, ly_clb_resolve_prefix resolve_prefix, void *parser, LYD_FORMAT format,
+                                    int options, ly_resolve_prefix_clb resolve_prefix, void *parser, LYD_FORMAT format,
                                     const void *context_node, const struct lyd_node *tree,
                                     struct lyd_value *storage, const char **canonized, struct ly_err_item **err);
 
@@ -234,7 +243,7 @@
  *         can be responsible for freeing allocated memory.
  * @return NULL in case of error.
  */
-typedef const char *(*ly_type_print_clb)(const struct lyd_value *value, LYD_FORMAT format, ly_clb_get_prefix get_prefix,
+typedef const char *(*ly_type_print_clb)(const struct lyd_value *value, LYD_FORMAT format, ly_get_prefix_clb get_prefix,
                                          void *printer, int *dynamic);
 
 /**
@@ -391,7 +400,7 @@
  * @return Created [sized array](@ref sizedarrays) of prefix mappings, NULL in case of error.
  */
 struct lyd_value_prefix *ly_type_get_prefixes(const struct ly_ctx *ctx, const char *value, size_t value_len,
-                                              ly_clb_resolve_prefix get_prefix, void *parser);
+                                              ly_resolve_prefix_clb get_prefix, void *parser);
 
 /** @} types */
 
diff --git a/src/printer_json.c b/src/printer_json.c
index 057bf6e..705d2eb 100644
--- a/src/printer_json.c
+++ b/src/printer_json.c
@@ -20,7 +20,7 @@
 /**
  * @brief JSON mapping of YANG modules to prefixes in values.
  *
- * Implementation of ly_clb_get_prefix.
+ * Implementation of ly_get_prefix_clb.
  */
 const char *
 json_print_get_prefix(const struct lys_module *mod, void *UNUSED(private))
diff --git a/src/printer_lyb.c b/src/printer_lyb.c
index 1b89e39..9331876 100644
--- a/src/printer_lyb.c
+++ b/src/printer_lyb.c
@@ -223,7 +223,7 @@
  * @return LY_ERR value.
  */
 static LY_ERR
-lyb_write(struct ly_out *out, const uint8_t *buf, size_t count, struct lyd_lyb_ctx *lybctx)
+lyb_write(struct ly_out *out, const uint8_t *buf, size_t count, struct lylyb_ctx *lybctx)
 {
     LY_ARRAY_COUNT_TYPE u;
     struct lyd_lyb_subtree *full, *iter;
@@ -307,7 +307,7 @@
  * @return LY_ERR value.
  */
 static LY_ERR
-lyb_write_stop_subtree(struct ly_out *out, struct lyd_lyb_ctx *lybctx)
+lyb_write_stop_subtree(struct ly_out *out, struct lylyb_ctx *lybctx)
 {
     ssize_t r;
     uint8_t meta_buf[LYB_META_BYTES];
@@ -334,7 +334,7 @@
  * @return LY_ERR value.
  */
 static LY_ERR
-lyb_write_start_subtree(struct ly_out *out, struct lyd_lyb_ctx *lybctx)
+lyb_write_start_subtree(struct ly_out *out, struct lylyb_ctx *lybctx)
 {
     ssize_t r;
     LY_ARRAY_COUNT_TYPE u;
@@ -381,7 +381,7 @@
  * @return LY_ERR value.
  */
 static LY_ERR
-lyb_write_number(uint64_t num, size_t bytes, struct ly_out *out, struct lyd_lyb_ctx *lybctx)
+lyb_write_number(uint64_t num, size_t bytes, struct ly_out *out, struct lylyb_ctx *lybctx)
 {
     /* correct byte order */
     num = htole64(num);
@@ -400,7 +400,7 @@
  * @return LY_ERR value.
  */
 static LY_ERR
-lyb_write_string(const char *str, size_t str_len, int with_length, struct ly_out *out, struct lyd_lyb_ctx *lybctx)
+lyb_write_string(const char *str, size_t str_len, int with_length, struct ly_out *out, struct lylyb_ctx *lybctx)
 {
     if (!str) {
         str = "";
@@ -432,7 +432,7 @@
  * @return LY_ERR value.
  */
 static LY_ERR
-lyb_print_model(struct ly_out *out, const struct lys_module *mod, struct lyd_lyb_ctx *lybctx)
+lyb_print_model(struct ly_out *out, const struct lys_module *mod, struct lylyb_ctx *lybctx)
 {
     int r;
     uint16_t revision;
@@ -477,7 +477,7 @@
  * @return LY_ERR value.
  */
 static LY_ERR
-lyb_print_data_models(struct ly_out *out, const struct lyd_node *root, struct lyd_lyb_ctx *lybctx)
+lyb_print_data_models(struct ly_out *out, const struct lyd_node *root, struct lylyb_ctx *lybctx)
 {
     struct ly_set *set;
     LY_ARRAY_COUNT_TYPE u;
@@ -577,7 +577,7 @@
  * @return LY_ERR value.
  */
 static LY_ERR
-lyb_print_opaq_prefixes(struct ly_out *out, const struct ly_prefix *prefs, struct lyd_lyb_ctx *lybctx)
+lyb_print_opaq_prefixes(struct ly_out *out, const struct ly_prefix *prefs, struct lylyb_ctx *lybctx)
 {
     uint8_t count;
     LY_ARRAY_COUNT_TYPE u;
@@ -595,10 +595,10 @@
     /* write all the prefixes */
     LY_ARRAY_FOR(prefs, u) {
         /* prefix */
-        LY_CHECK_RET(lyb_write_string(prefs[u].pref, 0, 1, out, lybctx));
+        LY_CHECK_RET(lyb_write_string(prefs[u].id, 0, 1, out, lybctx));
 
         /* namespace */
-        LY_CHECK_RET(lyb_write_string(prefs[u].ns, 0, 1, out, lybctx));
+        LY_CHECK_RET(lyb_write_string(prefs[u].module_name, 0, 1, out, lybctx));
     }
 
     return LY_SUCCESS;
@@ -613,13 +613,13 @@
  * @return LY_ERR value.
  */
 static LY_ERR
-lyb_print_opaq(struct lyd_node_opaq *opaq, struct ly_out *out, struct lyd_lyb_ctx *lybctx)
+lyb_print_opaq(struct lyd_node_opaq *opaq, struct ly_out *out, struct lylyb_ctx *lybctx)
 {
     /* prefix */
-    LY_CHECK_RET(lyb_write_string(opaq->prefix.pref, 0, 1, out, lybctx));
+    LY_CHECK_RET(lyb_write_string(opaq->prefix.id, 0, 1, out, lybctx));
 
-    /* namespace */
-    LY_CHECK_RET(lyb_write_string(opaq->prefix.ns, 0, 1, out, lybctx));
+    /* module reference */
+    LY_CHECK_RET(lyb_write_string(opaq->prefix.module_name, 0, 1, out, lybctx));
 
     /* name */
     LY_CHECK_RET(lyb_write_string(opaq->name, 0, 1, out, lybctx));
@@ -645,7 +645,7 @@
  * @return LY_ERR value.
  */
 static LY_ERR
-lyb_print_anydata(struct lyd_node_any *anydata, struct ly_out *out, struct lyd_lyb_ctx *lybctx)
+lyb_print_anydata(struct lyd_node_any *anydata, struct ly_out *out, struct lylyb_ctx *lybctx)
 {
     LY_ERR ret = LY_SUCCESS;
     LYD_ANYDATA_VALUETYPE value_type;
@@ -698,7 +698,7 @@
  * @return LY_ERR value.
  */
 static LY_ERR
-lyb_print_term(struct lyd_node_term *term, struct ly_out *out, struct lyd_lyb_ctx *lybctx)
+lyb_print_term(struct lyd_node_term *term, struct ly_out *out, struct lylyb_ctx *lybctx)
 {
     LY_ERR ret;
     int dynamic;
@@ -749,47 +749,47 @@
     }
     for (iter = node->meta; iter; iter = iter->next) {
         if (count == UINT8_MAX) {
-            LOGERR(lybctx->ctx, LY_EINT, "Maximum supported number of data node metadata is %u.", UINT8_MAX);
+            LOGERR(lybctx->lybctx->ctx, LY_EINT, "Maximum supported number of data node metadata is %u.", UINT8_MAX);
             return LY_EINT;
         }
         ++count;
     }
 
     /* write number of metadata on 1 byte */
-    LY_CHECK_RET(lyb_write(out, &count, 1, lybctx));
+    LY_CHECK_RET(lyb_write(out, &count, 1, lybctx->lybctx));
 
     if (wd_mod) {
         /* write the "default" metadata */
-        LY_CHECK_RET(lyb_write_start_subtree(out, lybctx));
-        LY_CHECK_RET(lyb_print_model(out, wd_mod, lybctx));
-        LY_CHECK_RET(lyb_write_string("default", 0, 1, out, lybctx));
-        LY_CHECK_RET(lyb_write_string("true", 0, 0, out, lybctx));
-        LY_CHECK_RET(lyb_write_stop_subtree(out, lybctx));
+        LY_CHECK_RET(lyb_write_start_subtree(out, lybctx->lybctx));
+        LY_CHECK_RET(lyb_print_model(out, wd_mod, lybctx->lybctx));
+        LY_CHECK_RET(lyb_write_string("default", 0, 1, out, lybctx->lybctx));
+        LY_CHECK_RET(lyb_write_string("true", 0, 0, out, lybctx->lybctx));
+        LY_CHECK_RET(lyb_write_stop_subtree(out, lybctx->lybctx));
     }
 
     /* write all the node metadata */
     LY_LIST_FOR(node->meta, iter) {
         /* each metadata is a subtree */
-        LY_CHECK_RET(lyb_write_start_subtree(out, lybctx));
+        LY_CHECK_RET(lyb_write_start_subtree(out, lybctx->lybctx));
 
         /* model */
-        LY_CHECK_RET(lyb_print_model(out, iter->annotation->module, lybctx));
+        LY_CHECK_RET(lyb_print_model(out, iter->annotation->module, lybctx->lybctx));
 
         /* annotation name with length */
-        LY_CHECK_RET(lyb_write_string(iter->name, 0, 1, out, lybctx));
+        LY_CHECK_RET(lyb_write_string(iter->name, 0, 1, out, lybctx->lybctx));
 
         /* get the value */
         str = lyd_meta2str(iter, &dynamic);
 
         /* metadata value */
-        ret = lyb_write_string(str, 0, 0, out, lybctx);
+        ret = lyb_write_string(str, 0, 0, out, lybctx->lybctx);
         if (dynamic) {
             free((char *)str);
         }
         LY_CHECK_RET(ret);
 
         /* finish metadata subtree */
-        LY_CHECK_RET(lyb_write_stop_subtree(out, lybctx));
+        LY_CHECK_RET(lyb_write_stop_subtree(out, lybctx->lybctx));
     }
 
     return LY_SUCCESS;
@@ -804,7 +804,7 @@
  * @return LY_ERR value.
  */
 static LY_ERR
-lyb_print_attributes(struct ly_out *out, const struct lyd_node_opaq *node, struct lyd_lyb_ctx *lybctx)
+lyb_print_attributes(struct ly_out *out, const struct lyd_node_opaq *node, struct lylyb_ctx *lybctx)
 {
     uint8_t count = 0;
     struct ly_attr *iter;
@@ -826,10 +826,10 @@
         LY_CHECK_RET(lyb_write_start_subtree(out, lybctx));
 
         /* prefix */
-        LY_CHECK_RET(lyb_write_string(iter->prefix.pref, 0, 1, out, lybctx));
+        LY_CHECK_RET(lyb_write_string(iter->prefix.id, 0, 1, out, lybctx));
 
         /* namespace */
-        LY_CHECK_RET(lyb_write_string(iter->prefix.ns, 0, 1, out, lybctx));
+        LY_CHECK_RET(lyb_write_string(iter->prefix.module_name, 0, 1, out, lybctx));
 
         /* name */
         LY_CHECK_RET(lyb_write_string(iter->name, 0, 1, out, lybctx));
@@ -860,7 +860,7 @@
  * @return LY_ERR value.
  */
 static LY_ERR
-lyb_print_schema_hash(struct ly_out *out, struct lysc_node *schema, struct hash_table **sibling_ht, struct lyd_lyb_ctx *lybctx)
+lyb_print_schema_hash(struct ly_out *out, struct lysc_node *schema, struct hash_table **sibling_ht, struct lylyb_ctx *lybctx)
 {
     LY_ARRAY_COUNT_TYPE u;
     uint32_t i;
@@ -941,36 +941,36 @@
     struct hash_table *child_ht = NULL;
 
     /* register a new subtree */
-    LY_CHECK_RET(lyb_write_start_subtree(out, lybctx));
+    LY_CHECK_RET(lyb_write_start_subtree(out, lybctx->lybctx));
 
     /* write model info first */
     if (!node->schema && !((struct lyd_node_opaq *)node)->parent) {
-        LY_CHECK_RET(lyb_print_model(out, NULL, lybctx));
+        LY_CHECK_RET(lyb_print_model(out, NULL, lybctx->lybctx));
     } else if (node->schema && !lysc_data_parent(node->schema)) {
-        LY_CHECK_RET(lyb_print_model(out, node->schema->module, lybctx));
+        LY_CHECK_RET(lyb_print_model(out, node->schema->module, lybctx->lybctx));
     }
 
     /* write schema hash */
-    LY_CHECK_RET(lyb_print_schema_hash(out, (struct lysc_node *)node->schema, sibling_ht, lybctx));
+    LY_CHECK_RET(lyb_print_schema_hash(out, (struct lysc_node *)node->schema, sibling_ht, lybctx->lybctx));
 
     /* write any metadata/attributes */
     if (node->schema) {
         LY_CHECK_RET(lyb_print_metadata(out, node, lybctx));
     } else {
-        LY_CHECK_RET(lyb_print_attributes(out, (struct lyd_node_opaq *)node, lybctx));
+        LY_CHECK_RET(lyb_print_attributes(out, (struct lyd_node_opaq *)node, lybctx->lybctx));
     }
 
     /* write node content */
     if (!node->schema) {
-        LY_CHECK_RET(lyb_print_opaq((struct lyd_node_opaq *)node, out, lybctx));
+        LY_CHECK_RET(lyb_print_opaq((struct lyd_node_opaq *)node, out, lybctx->lybctx));
     } else if (node->schema->nodetype & LYD_NODE_INNER) {
         /* nothing to write */
     } else if (node->schema->nodetype & LYD_NODE_TERM) {
-        LY_CHECK_RET(lyb_print_term((struct lyd_node_term *)node, out, lybctx));
+        LY_CHECK_RET(lyb_print_term((struct lyd_node_term *)node, out, lybctx->lybctx));
     } else if (node->schema->nodetype & LYD_NODE_ANY) {
-        LY_CHECK_RET(lyb_print_anydata((struct lyd_node_any *)node, out, lybctx));
+        LY_CHECK_RET(lyb_print_anydata((struct lyd_node_any *)node, out, lybctx->lybctx));
     } else {
-        LOGINT_RET(lybctx->ctx);
+        LOGINT_RET(lybctx->lybctx->ctx);
     }
 
     /* recursively write all the descendants */
@@ -979,7 +979,7 @@
     }
 
     /* finish this subtree */
-    LY_CHECK_RET(lyb_write_stop_subtree(out, lybctx));
+    LY_CHECK_RET(lyb_write_stop_subtree(out, lybctx->lybctx));
 
     return LY_SUCCESS;
 }
@@ -989,17 +989,22 @@
 {
     LY_ERR ret = LY_SUCCESS;
     uint8_t zero = 0;
-    LY_ARRAY_COUNT_TYPE u;
     struct hash_table *top_sibling_ht = NULL;
     const struct lys_module *prev_mod = NULL;
-    struct lyd_lyb_ctx lybctx = {0};
+    struct lyd_lyb_ctx *lybctx;
+    const struct ly_ctx *ctx = LYD_NODE_CTX(root);
 
-    lybctx.print_options = options;
+    lybctx = calloc(1, sizeof *lybctx);
+    LY_CHECK_ERR_RET(!lybctx, LOGMEM(ctx), LY_EMEM);
+    lybctx->lybctx = calloc(1, sizeof *lybctx->lybctx);
+    LY_CHECK_ERR_RET(!lybctx, LOGMEM(ctx), LY_EMEM);
+
+    lybctx->print_options = options;
     if (root) {
-        lybctx.ctx = LYD_NODE_CTX(root);
+        lybctx->lybctx->ctx = ctx;
 
         if (root->schema && lysc_data_parent(root->schema)) {
-            LOGERR(lybctx.ctx, LY_EINVAL, "LYB printer supports only printing top-level nodes.");
+            LOGERR(lybctx->lybctx->ctx, LY_EINVAL, "LYB printer supports only printing top-level nodes.");
             return LY_EINVAL;
         }
     }
@@ -1011,7 +1016,7 @@
     LY_CHECK_GOTO(ret = lyb_print_header(out), cleanup);
 
     /* all used models */
-    LY_CHECK_GOTO(ret = lyb_print_data_models(out, root, &lybctx), cleanup);
+    LY_CHECK_GOTO(ret = lyb_print_data_models(out, root, lybctx->lybctx), cleanup);
 
     LY_LIST_FOR(root, root) {
         /* do not reuse sibling hash tables from different modules */
@@ -1020,7 +1025,7 @@
             prev_mod = root->schema ? root->schema->module : NULL;
         }
 
-        LY_CHECK_GOTO(ret = lyb_print_subtree(out, root, &top_sibling_ht, &lybctx), cleanup);
+        LY_CHECK_GOTO(ret = lyb_print_subtree(out, root, &top_sibling_ht, lybctx), cleanup);
 
         if (!(options & LYD_PRINT_WITHSIBLINGS)) {
             break;
@@ -1028,14 +1033,9 @@
     }
 
     /* ending zero byte */
-    LY_CHECK_GOTO(ret = lyb_write(out, &zero, sizeof zero, &lybctx), cleanup);
+    LY_CHECK_GOTO(ret = lyb_write(out, &zero, sizeof zero, lybctx->lybctx), cleanup);
 
 cleanup:
-    LY_ARRAY_FREE(lybctx.subtrees);
-    LY_ARRAY_FOR(lybctx.sib_hts, u) {
-        lyht_free(lybctx.sib_hts[u].ht);
-    }
-    LY_ARRAY_FREE(lybctx.sib_hts);
-
+    lyd_lyb_ctx_free((struct lyd_ctx *)lybctx);
     return ret;
 }
diff --git a/src/printer_xml.c b/src/printer_xml.c
index 71e53c0..3a94406 100644
--- a/src/printer_xml.c
+++ b/src/printer_xml.c
@@ -50,6 +50,7 @@
 #define LEVEL_DEC if (LEVEL) {LEVEL--;}      /**< decrease indentation level */
 
 #define LYXML_PREFIX_REQUIRED 0x01  /**< The prefix is not just a suggestion but a requirement. */
+#define LYXML_PREFIX_DEFAULT  0x02  /**< The namespace is required to be a default (without prefix) */
 
 /**
  * @brief Print a namespace if not already printed.
@@ -107,10 +108,35 @@
     return ctx->prefix.objs[i];
 }
 
+static const char*
+xml_print_ns_opaq(struct xmlpr_ctx *ctx, LYD_FORMAT format, const struct ly_prefix *prefix, int prefix_opts)
+{
+
+    switch (format) {
+    case LYD_XML:
+        return xml_print_ns(ctx, prefix->module_ns, (prefix_opts & LYXML_PREFIX_DEFAULT) ? NULL : prefix->id, prefix_opts);
+        break;
+    case LYD_JSON:
+        if (prefix->module_name) {
+            const struct lys_module *mod = ly_ctx_get_module_latest(ctx->ctx, prefix->module_name);
+            if (mod) {
+                return xml_print_ns(ctx, mod->ns, (prefix_opts & LYXML_PREFIX_DEFAULT) ? NULL : prefix->id, prefix_opts);
+            }
+        }
+        break;
+    case LYD_SCHEMA:
+    case LYD_LYB:
+        /* cannot be created */
+        LOGINT(ctx->ctx);
+    }
+
+    return NULL;
+}
+
 /**
  * @brief XML mapping of YANG modules to prefixes in values.
  *
- * Implementation of ly_clb_get_prefix
+ * Implementation of ly_get_prefix_clb
  */
 static const char *
 xml_print_get_prefix(const struct lys_module *mod, void *private)
@@ -237,24 +263,15 @@
 
     LY_LIST_FOR(node->attr, attr) {
         pref = NULL;
-        if (attr->prefix.pref) {
+        if (attr->prefix.id) {
             /* print attribute namespace */
-            switch (attr->format) {
-            case LYD_XML:
-                pref = xml_print_ns(ctx, attr->prefix.ns, attr->prefix.pref, 0);
-                break;
-            case LYD_SCHEMA:
-            case LYD_LYB:
-                /* cannot be created */
-                LOGINT(node->ctx);
-                return LY_EINT;
-            }
+            pref = xml_print_ns_opaq(ctx, attr->format, &attr->prefix, 0);
         }
 
         /* print namespaces connected with the value's prefixes */
         if (attr->val_prefs) {
             LY_ARRAY_FOR(attr->val_prefs, u) {
-                xml_print_ns(ctx, attr->val_prefs[u].ns, attr->val_prefs[u].pref, LYXML_PREFIX_REQUIRED);
+                xml_print_ns_opaq(ctx, attr->format, &attr->val_prefs[u], LYXML_PREFIX_REQUIRED);
             }
         }
 
@@ -272,16 +289,7 @@
     ly_print(ctx->out, "%*s<%s", INDENT, node->name);
 
     /* print default namespace */
-    switch (node->format) {
-    case LYD_XML:
-        xml_print_ns(ctx, node->prefix.ns, NULL, 0);
-        break;
-    case LYD_SCHEMA:
-    case LYD_LYB:
-        /* cannot be created */
-        LOGINT(node->ctx);
-        return LY_EINT;
-    }
+    xml_print_ns_opaq(ctx, node->format, &node->prefix, LYXML_PREFIX_DEFAULT);
 
     /* print attributes */
     LY_CHECK_RET(xml_print_attr(ctx, node));
@@ -457,7 +465,7 @@
         /* print namespaces connected with the value's prefixes */
         if (node->val_prefs) {
             LY_ARRAY_FOR(node->val_prefs, u) {
-                xml_print_ns(ctx, node->val_prefs[u].ns, node->val_prefs[u].pref, LYXML_PREFIX_REQUIRED);
+                xml_print_ns_opaq(ctx, node->format, &node->val_prefs[u], LYXML_PREFIX_REQUIRED);
             }
         }
 
diff --git a/src/tree_data.c b/src/tree_data.c
index 5ca3f4a..a5572d7 100644
--- a/src/tree_data.c
+++ b/src/tree_data.c
@@ -55,14 +55,14 @@
                                       struct lyd_node **match);
 
 LY_ERR
-lyd_value_parse(struct lyd_node_term *node, const char *value, size_t value_len, int *dynamic, int second,
-                ly_clb_resolve_prefix get_prefix, void *parser, LYD_FORMAT format, const struct lyd_node *tree)
+lyd_value_parse(struct lyd_node_term *node, const char *value, size_t value_len, int *dynamic, int second, int value_hint,
+                ly_resolve_prefix_clb get_prefix, void *parser, LYD_FORMAT format, const struct lyd_node *tree)
 {
     LY_ERR ret = LY_SUCCESS;
     struct ly_err_item *err = NULL;
     struct ly_ctx *ctx;
     struct lysc_type *type;
-    int options = LY_TYPE_OPTS_STORE | (second ? LY_TYPE_OPTS_SECOND_CALL : 0) |
+    int options = value_hint | LY_TYPE_OPTS_STORE | (second ? LY_TYPE_OPTS_SECOND_CALL : 0) |
             (dynamic && *dynamic ? LY_TYPE_OPTS_DYNAMIC : 0) | (tree ? 0 : LY_TYPE_OPTS_INCOMPLETE_DATA);
     assert(node);
 
@@ -96,7 +96,7 @@
 /* similar to lyd_value_parse except can be used just to store the value, hence also does not support a second call */
 LY_ERR
 lyd_value_store(struct lyd_value *val, const struct lysc_node *schema, const char *value, size_t value_len, int *dynamic,
-                ly_clb_resolve_prefix get_prefix, void *parser, LYD_FORMAT format)
+                ly_resolve_prefix_clb get_prefix, void *parser, LYD_FORMAT format)
 {
     LY_ERR ret = LY_SUCCESS;
     struct ly_err_item *err = NULL;
@@ -128,13 +128,13 @@
 
 LY_ERR
 lyd_value_parse_meta(const struct ly_ctx *ctx, struct lyd_meta *meta, const char *value, size_t value_len, int *dynamic,
-                     int second, ly_clb_resolve_prefix get_prefix, void *parser, LYD_FORMAT format,
+                     int second, int value_hint, ly_resolve_prefix_clb get_prefix, void *parser, LYD_FORMAT format,
                      const struct lysc_node *ctx_snode, const struct lyd_node *tree)
 {
     LY_ERR ret = LY_SUCCESS;
     struct ly_err_item *err = NULL;
     struct lyext_metadata *ant;
-    int options = LY_TYPE_OPTS_STORE | (second ? LY_TYPE_OPTS_SECOND_CALL : 0) |
+    int options = value_hint | LY_TYPE_OPTS_STORE | (second ? LY_TYPE_OPTS_SECOND_CALL : 0) |
             (dynamic && *dynamic ? LY_TYPE_OPTS_DYNAMIC : 0) | (tree ? 0 : LY_TYPE_OPTS_INCOMPLETE_DATA);
 
     assert(ctx && meta && ((tree && meta->parent) || ctx_snode));
@@ -163,7 +163,7 @@
 
 LY_ERR
 _lys_value_validate(const struct ly_ctx *ctx, const struct lysc_node *node, const char *value, size_t value_len,
-                    ly_clb_resolve_prefix resolve_prefix, void *prefix_data, LYD_FORMAT format)
+                    ly_resolve_prefix_clb resolve_prefix, void *prefix_data, LYD_FORMAT format)
 {
     LY_ERR rc = LY_SUCCESS;
     struct ly_err_item *err = NULL;
@@ -309,10 +309,8 @@
 
         if (len >= 5 && !strncmp(&path[len - 4], ".xml", 4)) {
             format = LYD_XML;
-#if 0
         } else if (len >= 6 && !strncmp(&path[len - 5], ".json", 5)) {
             format = LYD_JSON;
-#endif
         } else if (len >= 5 && !strncmp(&path[len - 4], ".lyb", 4)) {
             format = LYD_LYB;
         } /* else still unknown */
@@ -325,6 +323,9 @@
 lyd_parse_data(const struct ly_ctx *ctx, struct ly_in *in, LYD_FORMAT format, int parse_options, int validate_options,
                struct lyd_node **tree)
 {
+    LY_ERR ret = LY_SUCCESS;
+    struct lyd_ctx *lydctx = NULL;
+
     LY_CHECK_ARG_RET(ctx, ctx, in, tree, LY_EINVAL);
     LY_CHECK_ARG_RET(ctx, !(parse_options & ~LYD_PARSE_OPTS_MASK), LY_EINVAL);
     LY_CHECK_ARG_RET(ctx, !(validate_options & ~LYD_VALIDATE_OPTS_MASK), LY_EINVAL);
@@ -332,26 +333,73 @@
     format = lyd_parse_get_format(in, format);
     LY_CHECK_ARG_RET(ctx, format, LY_EINVAL);
 
+    /* init */
+    *tree = NULL;
+
     /* remember input position */
     in->func_start = in->current;
 
     switch (format) {
     case LYD_XML:
-        return lyd_parse_xml_data(ctx, in, parse_options, validate_options, tree);
-#if 0
+        LY_CHECK_RET(lyd_parse_xml_data(ctx, in, parse_options, validate_options, tree, &lydctx));
+        break;
     case LYD_JSON:
-        return lyd_parse_json_data(ctx, in, parse_options, validate_options, tree);
-#endif
+        LY_CHECK_RET(lyd_parse_json_data(ctx, in, parse_options, validate_options, tree, &lydctx));
+        break;
     case LYD_LYB:
-        return lyd_parse_lyb_data(ctx, in, parse_options, validate_options, tree);
+        LY_CHECK_RET(lyd_parse_lyb_data(ctx, in, parse_options, validate_options, tree, &lydctx));
+        break;
     case LYD_SCHEMA:
         LOGINT_RET(ctx);
     }
 
-    /* TODO move here the top-level validation from parser_xml.c's lyd_parse_xml_data() and make
-     * it common for all the lyd_parse_*_data() functions */
+    if (!(parse_options & LYD_PARSE_ONLY)) {
+        uint32_t i = 0;
+        const struct lys_module *mod;
+        struct lyd_node *first, *next, **first2;
 
-    LOGINT_RET(ctx);
+        next = *tree;
+        while (1) {
+            if (validate_options & LYD_VALIDATE_PRESENT) {
+                mod = lyd_data_next_module(&next, &first);
+            } else {
+                mod = lyd_mod_next_module(next, NULL, ctx, &i, &first);
+            }
+            if (!mod) {
+                break;
+            }
+            if (first == *tree) {
+                /* make sure first2 changes are carried to tree */
+                first2 = tree;
+            } else {
+                first2 = &first;
+            }
+
+            /* validate new top-level nodes, autodelete CANNOT occur, all nodes are new */
+            LY_CHECK_GOTO(ret = lyd_validate_new(first2, NULL, mod, NULL), cleanup);
+
+            /* add all top-level defaults for this module */
+            ret = lyd_new_implicit_r(NULL, first2, NULL, mod, &lydctx->unres_node_type, &lydctx->when_check,
+                                     (validate_options & LYD_VALIDATE_NO_STATE) ? LYD_IMPLICIT_NO_STATE : 0, NULL);
+            LY_CHECK_GOTO(ret, cleanup);
+
+            /* finish incompletely validated terminal values/attributes and when conditions */
+            ret = lyd_validate_unres(tree, &lydctx->when_check, &lydctx->unres_node_type, &lydctx->unres_meta_type, LYD_XML,
+                                     lydctx->resolve_prefix, lydctx->data_ctx, NULL);
+            LY_CHECK_GOTO(ret, cleanup);
+
+            /* perform final validation that assumes the data tree is final */
+            LY_CHECK_GOTO(ret = lyd_validate_final_r(*first2, NULL, mod, validate_options, 0), cleanup);
+        }
+    }
+
+cleanup:
+    lydctx->free((struct lyd_ctx *)lydctx);
+    if (ret) {
+        lyd_free_all(*tree);
+        *tree = NULL;
+    }
+    return ret;
 }
 
 API LY_ERR
@@ -404,16 +452,20 @@
     format = lyd_parse_get_format(in, format);
     LY_CHECK_ARG_RET(ctx, format, LY_EINVAL);
 
+    /* init */
+    *tree = NULL;
+    if (op) {
+        *op = NULL;
+    }
+
     /* remember input position */
     in->func_start = in->current;
 
     switch (format) {
     case LYD_XML:
         return lyd_parse_xml_rpc(ctx, in, tree, op);
-#if 0
     case LYD_JSON:
         return lyd_parse_json_rpc(ctx, in, tree, op);
-#endif
     case LYD_LYB:
         return lyd_parse_lyb_rpc(ctx, in, tree, op);
     case LYD_SCHEMA:
@@ -428,21 +480,27 @@
                 struct lyd_node **op)
 {
     LY_CHECK_ARG_RET(NULL, request, LY_EINVAL);
-    LY_CHECK_ARG_RET(LYD_NODE_CTX(request), in, tree, LY_EINVAL);
+    LY_CHECK_ARG_RET(LYD_NODE_CTX(request), in, tree || op, LY_EINVAL);
 
     format = lyd_parse_get_format(in, format);
     LY_CHECK_ARG_RET(LYD_NODE_CTX(request), format, LY_EINVAL);
 
+    /* init */
+    if (tree) {
+        *tree = NULL;
+    }
+    if (op) {
+        *op = NULL;
+    }
+
     /* remember input position */
     in->func_start = in->current;
 
     switch (format) {
     case LYD_XML:
         return lyd_parse_xml_reply(request, in, tree, op);
-#if 0
     case LYD_JSON:
         return lyd_parse_json_reply(request, in, tree, op);
-#endif
     case LYD_LYB:
         return lyd_parse_lyb_reply(request, in, tree, op);
     case LYD_SCHEMA:
@@ -455,21 +513,27 @@
 API LY_ERR
 lyd_parse_notif(const struct ly_ctx *ctx, struct ly_in *in, LYD_FORMAT format, struct lyd_node **tree, struct lyd_node **ntf)
 {
-    LY_CHECK_ARG_RET(ctx, ctx, in, tree, LY_EINVAL);
+    LY_CHECK_ARG_RET(ctx, ctx, in, tree || ntf, LY_EINVAL);
 
     format = lyd_parse_get_format(in, format);
     LY_CHECK_ARG_RET(ctx, format, LY_EINVAL);
 
+    /* init */
+    if (tree) {
+        *tree = NULL;
+    }
+    if (ntf) {
+        *ntf = NULL;
+    }
+
     /* remember input position */
     in->func_start = in->current;
 
     switch (format) {
     case LYD_XML:
         return lyd_parse_xml_notif(ctx, in, tree, ntf);
-#if 0
     case LYD_JSON:
         return lyd_parse_json_notif(ctx, in, tree, ntf);
-#endif
     case LYD_LYB:
         return lyd_parse_lyb_notif(ctx, in, tree, ntf);
     case LYD_SCHEMA:
@@ -480,8 +544,8 @@
 }
 
 LY_ERR
-lyd_create_term(const struct lysc_node *schema, const char *value, size_t value_len, int *dynamic,
-                ly_clb_resolve_prefix get_prefix, void *prefix_data, LYD_FORMAT format, struct lyd_node **node)
+lyd_create_term(const struct lysc_node *schema, const char *value, size_t value_len, int *dynamic, int value_hint,
+                ly_resolve_prefix_clb get_prefix, void *prefix_data, LYD_FORMAT format, struct lyd_node **node)
 {
     LY_ERR ret;
     struct lyd_node_term *term;
@@ -495,7 +559,7 @@
     term->prev = (struct lyd_node *)term;
     term->flags = LYD_NEW;
 
-    ret = lyd_value_parse(term, value, value_len, dynamic, 0, get_prefix, prefix_data, format, NULL);
+    ret = lyd_value_parse(term, value, value_len, dynamic, 0, value_hint, get_prefix, prefix_data, format, NULL);
     if (ret && (ret != LY_EINCOMPLETE)) {
         free(term);
         return ret;
@@ -630,7 +694,8 @@
     any->prev = (struct lyd_node *)any;
     any->flags = LYD_NEW;
 
-    any->value.xml = value;
+    /* TODO: convert XML/JSON strings into a opaq data tree */
+    any->value.str = value;
     any->value_type = value_type;
     lyd_hash((struct lyd_node *)any);
 
@@ -640,12 +705,12 @@
 
 LY_ERR
 lyd_create_opaq(const struct ly_ctx *ctx, const char *name, size_t name_len, const char *value, size_t value_len,
-                int *dynamic, LYD_FORMAT format, struct ly_prefix *val_prefs, const char *prefix, size_t pref_len,
-                const char *ns, struct lyd_node **node)
+                int *dynamic, int value_hint, LYD_FORMAT format, struct ly_prefix *val_prefs, const char *prefix, size_t pref_len,
+                const char *module_key, size_t module_key_len, struct lyd_node **node)
 {
     struct lyd_node_opaq *opaq;
 
-    assert(ctx && name && name_len && ns);
+    assert(ctx && name && name_len);
 
     if (!value_len) {
         value = "";
@@ -659,9 +724,12 @@
     opaq->name = lydict_insert(ctx, name, name_len);
     opaq->format = format;
     if (pref_len) {
-        opaq->prefix.pref = lydict_insert(ctx, prefix, pref_len);
+        opaq->prefix.id = lydict_insert(ctx, prefix, pref_len);
     }
-    opaq->prefix.ns = lydict_insert(ctx, ns, 0);
+    if (module_key_len) {
+        opaq->prefix.module_ns = lydict_insert(ctx, module_key, module_key_len);
+    }
+
     opaq->val_prefs = val_prefs;
     if (dynamic && *dynamic) {
         opaq->value = lydict_insert_zc(ctx, (char *)value);
@@ -669,6 +737,7 @@
     } else {
         opaq->value = lydict_insert(ctx, value, value_len);
     }
+    opaq->hint = value_hint;
     opaq->ctx = ctx;
 
     *node = (struct lyd_node *)opaq;
@@ -731,7 +800,7 @@
     for (key_s = lysc_node_children(schema, 0); key_s && (key_s->flags & LYS_KEY); key_s = key_s->next) {
         key_val = va_arg(ap, const char *);
 
-        rc = lyd_create_term(key_s, key_val, key_val ? strlen(key_val) : 0, NULL, lydjson_resolve_prefix, NULL, LYD_JSON, &key);
+        rc = lyd_create_term(key_s, key_val, key_val ? strlen(key_val) : 0, NULL, 0, lydjson_resolve_prefix, NULL, LYD_JSON, &key);
         LY_CHECK_GOTO(rc && (rc != LY_EINCOMPLETE), cleanup);
         rc = LY_SUCCESS;
         lyd_insert_node(ret, NULL, key);
@@ -808,7 +877,7 @@
     schema = lys_find_child(parent ? parent->schema : NULL, module, name, 0, LYD_NODE_TERM, 0);
     LY_CHECK_ERR_RET(!schema, LOGERR(ctx, LY_EINVAL, "Term node \"%s\" not found.", name), LY_ENOTFOUND);
 
-    rc = lyd_create_term(schema, val_str, val_str ? strlen(val_str) : 0, NULL, lydjson_resolve_prefix, NULL, LYD_JSON, &ret);
+    rc = lyd_create_term(schema, val_str, val_str ? strlen(val_str) : 0, NULL, 0, lydjson_resolve_prefix, NULL, LYD_JSON, &ret);
     LY_CHECK_RET(rc && (rc != LY_EINCOMPLETE), rc);
     if (parent) {
         lyd_insert_node(parent, NULL, ret);
@@ -952,7 +1021,7 @@
         val_str = "";
     }
 
-    LY_CHECK_RET(lyd_create_meta(parent, &ret, module, name, name_len, val_str, strlen(val_str), NULL,
+    LY_CHECK_RET(lyd_create_meta(parent, &ret, module, name, name_len, val_str, strlen(val_str), NULL, 0,
                                  lydjson_resolve_prefix, NULL, LYD_JSON, parent->schema));
 
     if (meta) {
@@ -976,8 +1045,8 @@
         value = "";
     }
 
-    LY_CHECK_RET(lyd_create_opaq(ctx, name, strlen(name), value, strlen(value), NULL, LYD_JSON, NULL, NULL, 0,
-                                 module_name, &ret));
+    LY_CHECK_RET(lyd_create_opaq(ctx, name, strlen(name), value, strlen(value), NULL, 0,
+                                 LYD_JSON, NULL, NULL, 0, module_name, strlen(module_name), &ret));
     if (parent) {
         lyd_insert_node(parent, NULL, ret);
     }
@@ -990,9 +1059,9 @@
 
 API LY_ERR
 lyd_new_attr(struct lyd_node *parent, const char *module_name, const char *name, const char *val_str,
-             struct ly_attr **attr)
+             struct lyd_attr **attr)
 {
-    struct ly_attr *ret = NULL;
+    struct lyd_attr *ret = NULL;
     const struct ly_ctx *ctx;
     const char *prefix, *tmp;
     size_t pref_len, name_len;
@@ -1013,8 +1082,8 @@
         val_str = "";
     }
 
-    LY_CHECK_RET(ly_create_attr(parent, &ret, ctx, name, name_len, val_str, strlen(val_str), NULL, LYD_JSON, NULL,
-                                prefix, pref_len, module_name));
+    LY_CHECK_RET(lyd_create_attr(parent, &ret, ctx, name, name_len, val_str, strlen(val_str), NULL, 0, LYD_JSON, NULL,
+                                 prefix, pref_len, module_name, module_name ? strlen(module_name) : 0));
 
     if (attr) {
         *attr = ret;
@@ -1117,7 +1186,7 @@
 
     /* parse the new value into a new meta structure */
     LY_CHECK_GOTO(ret = lyd_create_meta(NULL, &m2, meta->annotation->module, meta->name, strlen(meta->name), val_str,
-                                        strlen(val_str), NULL, lydjson_resolve_prefix, NULL, LYD_JSON, NULL), cleanup);
+                                        strlen(val_str), NULL, 0, lydjson_resolve_prefix, NULL, LYD_JSON, NULL), cleanup);
 
     /* compare original and new value */
     if (lyd_compare_meta(meta, m2)) {
@@ -1238,8 +1307,9 @@
             if (!(schema->flags & LYS_KEYLESS)) {
                 if ((options & LYD_NEWOPT_OPAQ) && (p[path_idx].pred_type == LY_PATH_PREDTYPE_NONE)) {
                     /* creating opaque list without keys */
-                    LY_CHECK_GOTO(ret = lyd_create_opaq(ctx, schema->name, strlen(schema->name), NULL, 0, NULL,
-                                                        LYD_JSON, NULL, NULL, 0, schema->module->name, &node), cleanup);
+                    LY_CHECK_GOTO(ret = lyd_create_opaq(ctx, schema->name, strlen(schema->name), NULL, 0, NULL, 0,
+                                                        LYD_JSON, NULL, NULL, 0, schema->module->name, strlen(schema->module->name), &node),
+                                  cleanup);
                 } else {
                     assert(p[path_idx].pred_type == LY_PATH_PREDTYPE_LIST);
                     LY_CHECK_GOTO(ret = lyd_create_list(schema, p[path_idx].predicates, &node), cleanup);
@@ -1256,8 +1326,9 @@
         case LYS_LEAFLIST:
             if ((options & LYD_NEWOPT_OPAQ) && (p[path_idx].pred_type == LY_PATH_PREDTYPE_NONE)) {
                 /* creating opaque leaf-list without value */
-                LY_CHECK_GOTO(ret = lyd_create_opaq(ctx, schema->name, strlen(schema->name), NULL, 0, NULL,
-                                                    LYD_JSON, NULL, NULL, 0, schema->module->name, &node), cleanup);
+                LY_CHECK_GOTO(ret = lyd_create_opaq(ctx, schema->name, strlen(schema->name), NULL, 0, NULL, 0,
+                                                    LYD_JSON, NULL, NULL, 0, schema->module->name, strlen(schema->module->name), &node),
+                              cleanup);
             } else {
                 assert(p[path_idx].pred_type == LY_PATH_PREDTYPE_LEAFLIST);
                 LY_CHECK_GOTO(ret = lyd_create_term2(schema, &p[path_idx].predicates[0].value, &node), cleanup);
@@ -1274,12 +1345,13 @@
                 r = lys_value_validate(NULL, schema, value, strlen(value));
             }
             if (!r) {
-                LY_CHECK_GOTO(ret = lyd_create_term(schema, value, strlen(value), NULL, lydjson_resolve_prefix, NULL,
+                LY_CHECK_GOTO(ret = lyd_create_term(schema, value, strlen(value), NULL, 0, lydjson_resolve_prefix, NULL,
                                                     LYD_JSON, &node), cleanup);
             } else {
                 /* creating opaque leaf without value */
-                LY_CHECK_GOTO(ret = lyd_create_opaq(ctx, schema->name, strlen(schema->name), NULL, 0, NULL,
-                                                    LYD_JSON, NULL, NULL, 0, schema->module->name, &node), cleanup);
+                LY_CHECK_GOTO(ret = lyd_create_opaq(ctx, schema->name, strlen(schema->name), NULL, 0, NULL, 0,
+                                                    LYD_JSON, NULL, NULL, 0, schema->module->name, strlen(schema->module->name), &node),
+                              cleanup);
             }
             break;
         case LYS_ANYDATA:
@@ -2030,8 +2102,37 @@
 }
 
 LY_ERR
+lyd_insert_meta(struct lyd_node *parent, struct lyd_meta *meta)
+{
+    struct lyd_meta *last, *iter;
+
+    assert(parent);
+    assert(meta);
+
+    for (iter = meta; iter; iter = iter->next) {
+        iter->parent = parent;
+    }
+
+    /* insert as the last attribute */
+    if (parent->meta) {
+        for (last = parent->meta; last->next; last = last->next);
+        last->next = meta;
+    } else {
+        parent->meta = meta;
+    }
+
+    /* remove default flags from NP containers */
+    while (parent && (parent->schema->nodetype == LYS_CONTAINER) && (parent->flags & LYD_DEFAULT)) {
+        parent->flags &= ~LYD_DEFAULT;
+        parent = (struct lyd_node *)parent->parent;
+    }
+
+    return LY_SUCCESS;
+}
+
+LY_ERR
 lyd_create_meta(struct lyd_node *parent, struct lyd_meta **meta, const struct lys_module *mod, const char *name,
-                size_t name_len, const char *value, size_t value_len, int *dynamic, ly_clb_resolve_prefix resolve_prefix,
+                size_t name_len, const char *value, size_t value_len, int *dynamic, int value_hint, ly_resolve_prefix_clb resolve_prefix,
                 void *prefix_data, LYD_FORMAT format, const struct lysc_node *ctx_snode)
 {
     LY_ERR ret;
@@ -2060,7 +2161,7 @@
     LY_CHECK_ERR_RET(!mt, LOGMEM(mod->ctx), LY_EMEM);
     mt->parent = parent;
     mt->annotation = ant;
-    ret = lyd_value_parse_meta(mod->ctx, mt, value, value_len, dynamic, 0, resolve_prefix, prefix_data, format, ctx_snode, NULL);
+    ret = lyd_value_parse_meta(mod->ctx, mt, value, value_len, dynamic, 0, value_hint, resolve_prefix, prefix_data, format, ctx_snode, NULL);
     if ((ret != LY_SUCCESS) && (ret != LY_EINCOMPLETE)) {
         free(mt);
         return ret;
@@ -2069,23 +2170,12 @@
 
     /* insert as the last attribute */
     if (parent) {
-        if (parent->meta) {
-            for (last = parent->meta; last->next; last = last->next);
-            last->next = mt;
-        } else {
-            parent->meta = mt;
-        }
+        LY_CHECK_RET(lyd_insert_meta(parent, mt))
     } else if (*meta) {
         for (last = *meta; last->next; last = last->next);
         last->next = mt;
     }
 
-    /* remove default flags from NP containers */
-    while (parent && (parent->schema->nodetype == LYS_CONTAINER) && (parent->flags & LYD_DEFAULT)) {
-        parent->flags &= ~LYD_DEFAULT;
-        parent = (struct lyd_node *)parent->parent;
-    }
-
     if (meta) {
         *meta = mt;
     }
@@ -2093,16 +2183,15 @@
 }
 
 LY_ERR
-ly_create_attr(struct lyd_node *parent, struct ly_attr **attr, const struct ly_ctx *ctx, const char *name,
-               size_t name_len, const char *value, size_t value_len, int *dynamic, LYD_FORMAT format,
-               struct ly_prefix *val_prefs, const char *prefix, size_t prefix_len, const char *ns)
+lyd_create_attr(struct lyd_node *parent, struct lyd_attr **attr, const struct ly_ctx *ctx, const char *name,
+                size_t name_len, const char *value, size_t value_len, int *dynamic, int value_hint, LYD_FORMAT format,
+                struct ly_prefix *val_prefs, const char *prefix, size_t prefix_len, const char *module_key, size_t module_key_len)
 {
-    struct ly_attr *at, *last;
+    struct lyd_attr *at, *last;
     struct lyd_node_opaq *opaq;
 
     assert(ctx && (parent || attr) && (!parent || !parent->schema));
     assert(name && name_len);
-    assert((prefix_len && ns) || (!prefix_len && !ns));
 
     if (!value_len) {
         value = "";
@@ -2119,11 +2208,14 @@
         at->value = lydict_insert(ctx, value, value_len);
     }
 
+    at->hint = value_hint;
     at->format = format;
     at->val_prefs = val_prefs;
-    if (ns) {
-        at->prefix.pref = lydict_insert(ctx, prefix, prefix_len);
-        at->prefix.ns = lydict_insert(ctx, ns, 0);
+    if (prefix_len) {
+        at->prefix.id = lydict_insert(ctx, prefix, prefix_len);
+    }
+    if (module_key_len) {
+        at->prefix.module_ns = lydict_insert(ctx, module_key, module_key_len);
     }
 
     /* insert as the last attribute */
@@ -2187,7 +2279,7 @@
     if (!node1->schema) {
         opaq1 = (struct lyd_node_opaq *)node1;
         opaq2 = (struct lyd_node_opaq *)node2;
-        if ((opaq1->name != opaq2->name) || (opaq1->prefix.ns != opaq2->prefix.ns) || (opaq1->format != opaq2->format)) {
+        if ((opaq1->name != opaq2->name) || (opaq1->format != opaq2->format) || (opaq1->prefix.module_ns != opaq2->prefix.module_ns)) {
             return LY_ENOT;
         }
         switch (opaq1->format) {
@@ -2196,6 +2288,12 @@
                 return LY_ENOT;
             }
             break;
+        case LYD_JSON:
+            /* prefixes in JSON are unique, so it is not necessary to canonize the values */
+            if (strcmp(opaq1->value, opaq2->value)) {
+                return LY_ENOT;
+            }
+            break;
         case LYD_SCHEMA:
         case LYD_LYB:
             /* not allowed */
@@ -2438,17 +2536,15 @@
         }
         opaq->name = lydict_insert(LYD_NODE_CTX(node), orig->name, 0);
         opaq->format = orig->format;
-        if (orig->prefix.pref) {
-            opaq->prefix.pref = lydict_insert(LYD_NODE_CTX(node), orig->prefix.pref, 0);
+        if (orig->prefix.id) {
+            opaq->prefix.id = lydict_insert(LYD_NODE_CTX(node), orig->prefix.id, 0);
         }
-        if (orig->prefix.ns) {
-            opaq->prefix.ns = lydict_insert(LYD_NODE_CTX(node), orig->prefix.ns, 0);
-        }
+        opaq->prefix.module_ns = lydict_insert(LYD_NODE_CTX(node), orig->prefix.module_ns, 0);
         if (orig->val_prefs) {
             LY_ARRAY_CREATE_GOTO(LYD_NODE_CTX(node), opaq->val_prefs, LY_ARRAY_COUNT(orig->val_prefs), ret, error);
             LY_ARRAY_FOR(orig->val_prefs, u) {
-                opaq->val_prefs[u].pref = lydict_insert(LYD_NODE_CTX(node), orig->val_prefs[u].pref, 0);
-                opaq->val_prefs[u].ns = lydict_insert(LYD_NODE_CTX(node), orig->val_prefs[u].ns, 0);
+                opaq->val_prefs[u].id = lydict_insert(LYD_NODE_CTX(node), orig->val_prefs[u].id, 0);
+                opaq->val_prefs[u].module_ns = lydict_insert(LYD_NODE_CTX(node), orig->val_prefs[u].module_ns, 0);
                 LY_ARRAY_INCREMENT(opaq->val_prefs);
             }
         }
@@ -2954,22 +3050,23 @@
 iter_print:
             /* print prefix and name */
             mod = NULL;
-            if (!iter->parent || (iter->schema->module != iter->parent->schema->module)) {
+            if (iter->schema && (!iter->parent || iter->schema->module != iter->parent->schema->module)) {
                 mod = iter->schema->module;
             }
 
             /* realloc string */
-            len = 1 + (mod ? strlen(mod->name) + 1 : 0) + strlen(iter->schema->name);
+            len = 1 + (mod ? strlen(mod->name) + 1 : 0) + (iter->schema ? strlen(iter->schema->name) : strlen(((struct lyd_node_opaq*)iter)->name));
             rc = lyd_path_str_enlarge(&buffer, &buflen, bufused + len, is_static);
             if (rc != LY_SUCCESS) {
                 break;
             }
 
             /* print next node */
-            bufused += sprintf(buffer + bufused, "/%s%s%s", mod ? mod->name : "", mod ? ":" : "", iter->schema->name);
+            bufused += sprintf(buffer + bufused, "/%s%s%s", mod ? mod->name : "", mod ? ":" : "",
+                               iter->schema ? iter->schema->name : ((struct lyd_node_opaq*)iter)->name);
 
             /* do not always print the last (first) predicate */
-            if (bufused || (pathtype == LYD_PATH_LOG)) {
+            if (iter->schema && (bufused || (pathtype == LYD_PATH_LOG))) {
                 switch (iter->schema->nodetype) {
                 case LYS_LIST:
                     if (iter->schema->flags & LYS_KEYLESS) {
@@ -3216,7 +3313,7 @@
         /* create a data node and find the instance */
         if (schema->nodetype == LYS_LEAFLIST) {
             /* target used attributes: schema, hash, value */
-            rc = lyd_create_term(schema, key_or_value, val_len, NULL, lydjson_resolve_prefix, NULL, LYD_JSON, &target);
+            rc = lyd_create_term(schema, key_or_value, val_len, NULL, 0, lydjson_resolve_prefix, NULL, LYD_JSON, &target);
             LY_CHECK_RET(rc && (rc != LY_EINCOMPLETE), rc);
         } else {
             /* target used attributes: schema, hash, child (all keys) */
diff --git a/src/tree_data.h b/src/tree_data.h
index 58f5aeb..4aa13f5 100644
--- a/src/tree_data.h
+++ b/src/tree_data.h
@@ -194,6 +194,7 @@
             } *prefixes;                 /**< list of mappings between prefix in canonized value to a YANG schema ([sized array](@ref sizedarrays)) */
             struct lyd_value *value;     /**< representation of the value according to the selected union's subtype (stored as lyd_value::realpath
                                               here, in subvalue structure */
+            int parser_hint;             /**< Hint options from the parser */
         } *subvalue;                     /**< data to represent data with multiple types (union). Original value is stored in the main
                                               lyd_value:canonical_cache while the lyd_value_subvalue::value contains representation according to the
                                               one of the union's type. The lyd_value_subvalue:prefixes provides (possible) mappings from prefixes
@@ -238,23 +239,31 @@
 
 /**
  * @brief Generic prefix and namespace mapping, meaning depends on the format.
+ *
+ * The union is used as a reference to the data's module and according to the format, it can be used as a key for
+ * ly_ctx_get_module_implemented_ns() or ly_ctx_get_module_implemented(). While the module reference is always present,
+ * the id member can be omitted in case it is not present in the source data as a reference to the default namespace.
  */
 struct ly_prefix {
-    const char *pref;
-    const char *ns;
+    const char *id;               /**< identifier used in the qualified name of the item to reference data node namespace */
+    union {
+        const char *module_ns;    /**< namespace of the module where the data are supposed to belongs to, used for LYD_XML format. */
+        const char *module_name;  /**< name of the module where the data are supposed to belongs to, used for LYD_JSON format. */
+    };
 };
 
 /**
  * @brief Generic attribute structure.
  */
-struct ly_attr {
+struct lyd_attr {
     struct lyd_node_opaq *parent;   /**< data node where the attribute is placed */
-    struct ly_attr *next;
+    struct lyd_attr *next;
     struct ly_prefix *val_prefs;    /**< list of prefixes in the value ([sized array](@ref sizedarrays)) */
     const char *name;
     const char *value;
 
     LYD_FORMAT format;
+    int hint;                       /**< additional information about from the data source, see the [hints list](@ref lydopaqhints) */
     struct ly_prefix prefix;        /**< name prefix, it is stored because they are a real pain to generate properly */
 
 };
@@ -293,6 +302,37 @@
 /** @} */
 
 /**
+ * @brief Callback provided by the data/schema parsers to type plugins to resolve (format-specific) mapping between prefixes used
+ * in the value strings to the YANG schemas.
+ *
+ * Reverse function to ly_get_prefix_clb.
+ *
+ * XML uses XML namespaces, JSON uses schema names as prefixes, YIN/YANG uses prefixes of the imports.
+ *
+ * @param[in] ctx libyang context to find the schema.
+ * @param[in] prefix Prefix found in the value string
+ * @param[in] prefix_len Length of the @p prefix.
+ * @param[in] private Internal data needed by the callback.
+ * @return Pointer to the YANG schema identified by the provided prefix or NULL if no mapping found.
+ */
+typedef const struct lys_module *(*ly_resolve_prefix_clb)(const struct ly_ctx *ctx, const char *prefix, size_t prefix_len,
+                                                          void *private);
+
+/**
+ * @brief Callback provided by the data/schema printers to type plugins to resolve (format-specific) mapping between YANG module of a data object
+ * to prefixes used in the value strings.
+ *
+ * Reverse function to ly_resolve_prefix_clb.
+ *
+ * XML uses XML namespaces, JSON uses schema names as prefixes, YIN/YANG uses prefixes of the imports.
+ *
+ * @param[in] mod YANG module of the object.
+ * @param[in] private Internal data needed by the callback.
+ * @return String representing prefix for the object of the given YANG module @p mod.
+ */
+typedef const char *(*ly_get_prefix_clb)(const struct lys_module *mod, void *private);
+
+/**
  * @brief Generic structure for a data node.
  */
 struct lyd_node {
@@ -401,6 +441,23 @@
 };
 
 /**
+ * @defgroup lydopaqhints Opaq data node hints.
+ *
+ * Additional information about the opaq nodes from their source. The flags are stored in lyd_node_opaq::hint
+ * and they can have a slightly different meaning for the specific lyd_node_opaq::format.
+ * @{
+ */
+#define LYD_NODE_OPAQ_ISLIST       0x001 /**< LYD_JSON: node is expected to be a list or leaf-list */
+#define LYD_NODE_OPAQ_ISENVELOPE   0x002 /**< LYD_JSON, LYD_XML: RPC/Action/Notification envelope out of the YANG schemas */
+
+#define LYD_NODE_OPAQ_ISSTRING     0x100 /**< LYD_JSON: value is expected to be string as defined in JSON encoding. */
+#define LYD_NODE_OPAQ_ISNUMBER     0x200 /**< LYD_JSON: value is expected to be number as defined in JSON encoding. */
+#define LYD_NODE_OPAQ_ISBOOLEAN    0x400 /**< LYD_JSON: value is expected to be boolean as defined in JSON encoding. */
+#define LYD_NODE_OPAQ_ISEMPTY      0x800 /**< LYD_JSON: value is expected to be empty as defined in JSON encoding. */
+
+/** @} lydopaqhints */
+
+/**
  * @brief Data node structure for unparsed (opaque) nodes.
  */
 struct lyd_node_opaq {
@@ -410,7 +467,7 @@
     struct lyd_node *parent;        /**< pointer to the parent node (NULL in case of root node) */
     struct lyd_node *next;          /**< pointer to the next sibling node (NULL if there is no one) */
     struct lyd_node *prev;          /**< pointer to the previous sibling node (last sibling if there is none) */
-    struct ly_attr *attr;
+    struct lyd_attr *attr;
 
 #ifdef LY_ENABLED_LYD_PRIV
     void *priv;                     /**< private user data, not used by libyang */
@@ -422,6 +479,7 @@
     struct ly_prefix prefix;        /**< name prefix */
     struct ly_prefix *val_prefs;    /**< list of prefixes in the value ([sized array](@ref sizedarrays)) */
     const char *value;              /**< original value */
+    int hint;                       /**< additional information about from the data source, see the [hints list](@ref lydopaqhints) */
     const struct ly_ctx *ctx;       /**< libyang context */
 };
 
@@ -580,7 +638,7 @@
  * @return LY_ERR value.
  */
 LY_ERR lyd_new_attr(struct lyd_node *parent, const char *module_name, const char *name, const char *val_str,
-                    struct ly_attr **attr);
+                    struct lyd_attr **attr);
 
 /**
  * @defgroup pathoptions Data path creation options
@@ -845,7 +903,7 @@
  * @param[in] ctx Context where the attributes were created.
  * @param[in] attr Attribute to free.
  */
-void ly_free_attr_single(const struct ly_ctx *ctx, struct ly_attr *attr);
+void ly_free_attr_single(const struct ly_ctx *ctx, struct lyd_attr *attr);
 
 /**
  * @brief Free the attribute with any following attributes.
@@ -853,7 +911,7 @@
  * @param[in] ctx Context where the attributes were created.
  * @param[in] attr First attribute to free.
  */
-void ly_free_attr_siblings(const struct ly_ctx *ctx, struct ly_attr *attr);
+void ly_free_attr_siblings(const struct ly_ctx *ctx, struct lyd_attr *attr);
 
 /**
  * @brief Check type restrictions applicable to the particular leaf/leaf-list with the given string @p value.
diff --git a/src/tree_data_free.c b/src/tree_data_free.c
index 7cd1283..519ce06 100644
--- a/src/tree_data_free.c
+++ b/src/tree_data_free.c
@@ -78,9 +78,9 @@
 }
 
 static void
-ly_free_attr(const struct ly_ctx *ctx, struct ly_attr *attr, int siblings)
+ly_free_attr(const struct ly_ctx *ctx, struct lyd_attr *attr, int siblings)
 {
-    struct ly_attr *iter;
+    struct lyd_attr *iter;
     LY_ARRAY_COUNT_TYPE u;
 
     LY_CHECK_ARG_RET(NULL, ctx, );
@@ -116,26 +116,26 @@
         iter = iter->next;
 
         LY_ARRAY_FOR(attr->val_prefs, u) {
-            FREE_STRING(ctx, attr->val_prefs[u].pref);
-            FREE_STRING(ctx, attr->val_prefs[u].ns);
+            FREE_STRING(ctx, attr->val_prefs[u].id);
+            FREE_STRING(ctx, attr->val_prefs[u].module_ns);
         }
         LY_ARRAY_FREE(attr->val_prefs);
         FREE_STRING(ctx, attr->name);
         FREE_STRING(ctx, attr->value);
-        FREE_STRING(ctx, attr->prefix.pref);
-        FREE_STRING(ctx, attr->prefix.ns);
+        FREE_STRING(ctx, attr->prefix.id);
+        FREE_STRING(ctx, attr->prefix.module_ns);
         free(attr);
     }
 }
 
 API void
-ly_free_attr_single(const struct ly_ctx *ctx, struct ly_attr *attr)
+ly_free_attr_single(const struct ly_ctx *ctx, struct lyd_attr *attr)
 {
     ly_free_attr(ctx, attr, 0);
 }
 
 API void
-ly_free_attr_siblings(const struct ly_ctx *ctx, struct ly_attr *attr)
+ly_free_attr_siblings(const struct ly_ctx *ctx, struct lyd_attr *attr)
 {
     ly_free_attr(ctx, attr, 1);
 }
@@ -146,8 +146,8 @@
     LY_ARRAY_COUNT_TYPE u;
 
     LY_ARRAY_FOR(val_prefs, u) {
-        FREE_STRING(ctx, val_prefs[u].pref);
-        FREE_STRING(ctx, val_prefs[u].ns);
+        FREE_STRING(ctx, val_prefs[u].id);
+        FREE_STRING(ctx, val_prefs[u].module_ns);
     }
     LY_ARRAY_FREE(val_prefs);
 }
@@ -176,8 +176,8 @@
         }
 
         FREE_STRING(LYD_NODE_CTX(opaq), opaq->name);
-        FREE_STRING(LYD_NODE_CTX(opaq), opaq->prefix.pref);
-        FREE_STRING(LYD_NODE_CTX(opaq), opaq->prefix.ns);
+        FREE_STRING(LYD_NODE_CTX(opaq), opaq->prefix.id);
+        FREE_STRING(LYD_NODE_CTX(opaq), opaq->prefix.module_ns);
         ly_free_val_prefs(LYD_NODE_CTX(opaq), opaq->val_prefs);
         FREE_STRING(LYD_NODE_CTX(opaq), opaq->value);
     } else if (node->schema->nodetype & LYD_NODE_INNER) {
diff --git a/src/tree_data_helpers.c b/src/tree_data_helpers.c
index 0e8a17b..3dce35c 100644
--- a/src/tree_data_helpers.c
+++ b/src/tree_data_helpers.c
@@ -188,7 +188,7 @@
     key = lyd_node_children(node, 0);
     while ((skey = lys_getnext(skey, node->schema, NULL, 0)) && (skey->flags & LYS_KEY)) {
         if (!key || (key->schema != skey)) {
-            LOGVAL(node->schema->module->ctx, LY_VLOG_LYD, node, LY_VCODE_NOKEY, skey->name);
+            LOGVAL(LYD_NODE_CTX(node), LY_VLOG_LYD, node, LY_VCODE_NOKEY, skey->name);
             return LY_EVALID;
         }
 
diff --git a/src/tree_data_internal.h b/src/tree_data_internal.h
index eb934ca..7911fe0 100644
--- a/src/tree_data_internal.h
+++ b/src/tree_data_internal.h
@@ -94,6 +94,7 @@
  * @param[in] value String value to be parsed.
  * @param[in] value_len Length of @p value, must be set correctly.
  * @param[in,out] dynamic Flag if @p value is dynamically allocated, is adjusted when @p value is consumed.
+ * @param[in] value_hint [Hint options](@ref lydvalueparseopts) from the parser regarding the value type.
  * @param[in] get_prefix Parser-specific getter to resolve prefixes used in the @p value string.
  * @param[in] prefix_data User data for @p get_prefix.
  * @param[in] format Input format of @p value.
@@ -102,8 +103,8 @@
  * @return LY_EINCOMPLETE in case data tree is needed to finish the validation.
  * @return LY_ERR value if an error occurred.
  */
-LY_ERR lyd_create_term(const struct lysc_node *schema, const char *value, size_t value_len, int *dynamic,
-                       ly_clb_resolve_prefix get_prefix, void *prefix_data, LYD_FORMAT format, struct lyd_node **node);
+LY_ERR lyd_create_term(const struct lysc_node *schema, const char *value, size_t value_len, int *dynamic, int value_hint,
+                       ly_resolve_prefix_clb get_prefix, void *prefix_data, LYD_FORMAT format, struct lyd_node **node);
 
 /**
  * @brief Create a term (leaf/leaf-list) node from a parsed value by duplicating it.
@@ -169,18 +170,20 @@
  * @param[in] value String value to be parsed.
  * @param[in] value_len Length of @p value, must be set correctly.
  * @param[in,out] dynamic Flag if @p value is dynamically allocated, is adjusted when @p value is consumed.
+ * @param[in] value_hint [Value hint](@ref lydvalueparseopts) from the parser regarding the value type.
  * @param[in] format Input format of @p value and @p ns.
  * @param[in] val_prefs Possible value prefixes, array is spent.
  * @param[in] prefix Element prefix.
  * @param[in] pref_len Length of @p prefix, must be set correctly.
- * @param[in] ns Node namespace, meaning depends on @p format.
+ * @param[in] module_key Mandatory key to reference module, can be namespace or name.
+ * @param[in] module_key_len Length of @p module_key, must be set correctly.
  * @param[out] node Created node.
  * @return LY_SUCCESS on success.
  * @return LY_ERR value if an error occurred.
  */
 LY_ERR lyd_create_opaq(const struct ly_ctx *ctx, const char *name, size_t name_len, const char *value, size_t value_len,
-                       int *dynamic, LYD_FORMAT format, struct ly_prefix *val_prefs, const char *prefix, size_t pref_len,
-                       const char *ns, struct lyd_node **node);
+                       int *dynamic, int value_hint, LYD_FORMAT format, struct ly_prefix *val_prefs, const char *prefix, size_t pref_len,
+                       const char *module_key, size_t module_key_len, struct lyd_node **node);
 
 /**
  * @brief Check the existence and create any non-existing implicit siblings, recursively for the created nodes.
@@ -229,6 +232,7 @@
  * @param[in] value String value to be parsed.
  * @param[in] value_len Length of @p value, must be set correctly.
  * @param[in,out] dynamic Flag if @p value is dynamically allocated, is adjusted when @p value is consumed.
+ * @param[in] value_hint [Value hint](@ref lydvalueparseopts) from the parser regarding the value type.
  * @param[in] resolve_prefix Parser-specific getter to resolve prefixes used in the @p value string.
  * @param[in] prefix_data User data for @p get_prefix.
  * @param[in] format Input format of @p value.
@@ -238,8 +242,17 @@
  * @return LY_ERR value if an error occurred.
  */
 LY_ERR lyd_create_meta(struct lyd_node *parent, struct lyd_meta **meta, const struct lys_module *mod, const char *name,
-                       size_t name_len, const char *value, size_t value_len, int *dynamic, ly_clb_resolve_prefix resolve_prefix,
-                       void *prefix_data, LYD_FORMAT format, const struct lysc_node *ctx_snode);
+                       size_t name_len, const char *value, size_t value_len, int *dynamic, int value_hint,
+                       ly_resolve_prefix_clb resolve_prefix, void *prefix_data, LYD_FORMAT format, const struct lysc_node *ctx_snode);
+
+/**
+ * @brief Insert a metadata (last) into a parent
+ *
+ * @param[in] parent Parent of the metadata.
+ * @param[in] meta Metadata (list) to be added into the @p parent.
+ * @return LY_SUCCESS on success.
+ */
+LY_ERR lyd_insert_meta(struct lyd_node *parent, struct lyd_meta *meta);
 
 /**
  * @brief Create and insert a generic attribute (last) into a parent.
@@ -252,17 +265,32 @@
  * @param[in] value String value to be parsed.
  * @param[in] value_len Length of @p value, must be set correctly.
  * @param[in,out] dynamic Flag if @p value is dynamically allocated, is adjusted when @p value is consumed.
+ * @param[in] value_hint [Value hint](@ref lydvalueparseopts) from the parser regarding the value type.
  * @param[in] format Input format of @p value and @p ns.
  * @param[in] val_prefs Possible value prefixes, array is spent.
  * @param[in] prefix Attribute prefix.
  * @param[in] prefix_len Attribute prefix length.
- * @param[in] ns Attribute namespace, meaning depends on @p format.
+ * @param[in] module_key Mandatory key to reference module, can be namespace or name.
+ * @param[in] module_key_len Length of @p module_key, must be set correctly.
  * @return LY_SUCCESS on success.
  * @return LY_ERR value if an error occurred.
  */
-LY_ERR ly_create_attr(struct lyd_node *parent, struct ly_attr **attr, const struct ly_ctx *ctx, const char *name,
-                      size_t name_len, const char *value, size_t value_len, int *dynamic, LYD_FORMAT format,
-                      struct ly_prefix *val_prefs, const char *prefix, size_t prefix_len, const char *ns);
+LY_ERR lyd_create_attr(struct lyd_node *parent, struct lyd_attr **attr, const struct ly_ctx *ctx, const char *name,
+                       size_t name_len, const char *value, size_t value_len, int *dynamic, int value_hint, LYD_FORMAT format,
+                       struct ly_prefix *val_prefs, const char *prefix, size_t prefix_len, const char *module_key, size_t module_key_len);
+
+/**
+ * @defgroup lydvalueparseopts Hint options for type plugin callbacks from the data parsers.
+ *
+ * Options applicable to ly_value_parse()
+ * @{
+ */
+#define LYD_VALUE_PARSE_ISSTRING LY_TYPE_OPTS_ISSTRING /**< The input value is supposed to be a string. */
+#define LYD_VALUE_PARSE_ISNUMBER LY_TYPE_OPTS_ISNUMBER /**< The input value is supposed to be a number. */
+#define LYD_VALUE_PARSE_ISBOOLEAN LY_TYPE_OPTS_ISBOOLEAN /**< The input value is supposed to be a boolean. */
+#define LYD_VALUE_PARSE_ISEMPTY LY_TYPE_OPTS_ISEMPTY /**< The input value is supposed to be empty type. */
+
+/** @} lydvalueparseopts */
 
 /**
  * @brief Validate, canonize and store the given @p value into the node according to the node's type's rules.
@@ -272,6 +300,7 @@
  * @param[in] value_len Length of the give @p value, must be set correctly.
  * @param[in,out] dynamic Flag if @p value is dynamically allocated, is adjusted when @p value is consumed.
  * @param[in] second Flag for the second call after returning LY_EINCOMPLETE
+ * @param[in] value_hint [Value hint](@ref lydvalueparseopts) from the parser.
  * @param[in] get_prefix Parser-specific getter to resolve prefixes used in the @p value string.
  * @param[in] parser Parser's data for @p get_prefix
  * @param[in] format Input format of @p value.
@@ -282,12 +311,12 @@
  * @return LY_EINCOMPLETE in case the @p trees is not provided and it was needed to finish the validation.
  * @return LY_ERR value if an error occurred.
  */
-LY_ERR lyd_value_parse(struct lyd_node_term *node, const char *value, size_t value_len, int *dynamic, int second,
-                       ly_clb_resolve_prefix get_prefix, void *parser, LYD_FORMAT format, const struct lyd_node *tree);
+LY_ERR lyd_value_parse(struct lyd_node_term *node, const char *value, size_t value_len, int *dynamic, int second, int value_hint,
+                       ly_resolve_prefix_clb get_prefix, void *parser, LYD_FORMAT format, const struct lyd_node *tree);
 
 /* similar to lyd_value_parse except can be used just to store the value, hence does also not support a second call */
 LY_ERR lyd_value_store(struct lyd_value *val, const struct lysc_node *schema, const char *value, size_t value_len,
-                       int *dynamic, ly_clb_resolve_prefix get_prefix, void *parser, LYD_FORMAT format);
+                       int *dynamic, ly_resolve_prefix_clb get_prefix, void *parser, LYD_FORMAT format);
 
 /**
  * @brief Validate, canonize and store the given @p value into the metadata according to the annotation type's rules.
@@ -298,6 +327,7 @@
  * @param[in] value_len Length of the give @p value, must be set correctly.
  * @param[in,out] dynamic Flag if @p value is dynamically allocated, is adjusted when @p value is consumed.
  * @param[in] second Flag for the second call after returning LY_EINCOMPLETE
+ * @param[in] value_hint [Value hint](@ref lydvalueparseopts) from the parser.
  * @param[in] get_prefix Parser-specific getter to resolve prefixes used in the @p value string.
  * @param[in] parser Parser's data for @p get_prefix
  * @param[in] format Input format of the data.
@@ -310,8 +340,8 @@
  * @return LY_ERR value if an error occurred.
  */
 LY_ERR lyd_value_parse_meta(const struct ly_ctx *ctx, struct lyd_meta *meta, const char *value, size_t value_len,
-                            int *dynamic, int second, ly_clb_resolve_prefix get_prefix, void *parser, LYD_FORMAT format,
-                            const struct lysc_node *ctx_snode, const struct lyd_node *tree);
+                            int *dynamic, int second, int value_hint, ly_resolve_prefix_clb get_prefix, void *parser,
+                            LYD_FORMAT format, const struct lysc_node *ctx_snode, const struct lyd_node *tree);
 
 /* generic function lys_value_validate */
 LY_ERR _lys_value_validate(const struct ly_ctx *ctx, const struct lysc_node *node, const char *value, size_t value_len,
@@ -324,11 +354,12 @@
  * @param[in] in Input structure.
  * @param[in] parse_options Options for parser, see @ref dataparseroptions.
  * @param[in] validate_options Options for the validation phase, see @ref datavalidationoptions.
- * @param[out] tree Parsed data tree. Note that NULL can be a valid result.
+ * @param[out] tree_p Parsed data tree. Note that NULL can be a valid result.
+ * @param[out] lydctx_p Data parser context to finish validation.
  * @return LY_ERR value.
  */
 LY_ERR lyd_parse_xml_data(const struct ly_ctx *ctx, struct ly_in *in, int parse_options, int validate_options,
-                          struct lyd_node **tree);
+                          struct lyd_node **tree_p, struct lyd_ctx **lydctx_p);
 
 /**
  * @brief Parse XML string as YANG RPC/action invocation.
@@ -339,11 +370,11 @@
  *
  * @param[in] ctx libyang context.
  * @param[in] in Input structure.
- * @param[out] tree Parsed full RPC/action tree.
- * @param[out] op Optional pointer to the actual operation. Useful mainly for action.
+ * @param[out] tree_p Parsed full RPC/action tree.
+ * @param[out] op_p Optional pointer to the actual operation. Useful mainly for action.
  * @return LY_ERR value.
  */
-LY_ERR lyd_parse_xml_rpc(const struct ly_ctx *ctx, struct ly_in *in, struct lyd_node **tree, struct lyd_node **op);
+LY_ERR lyd_parse_xml_rpc(const struct ly_ctx *ctx, struct ly_in *in, struct lyd_node **tree_p, struct lyd_node **op_p);
 
 /**
  * @brief Parse XML string as YANG notification.
@@ -353,11 +384,11 @@
  *
  * @param[in] ctx libyang context.
  * @param[in] in Input structure.
- * @param[out] tree Parsed full notification tree.
- * @param[out] op Optional pointer to the actual notification. Useful mainly for nested notifications.
+ * @param[out] tree_p Parsed full notification tree.
+ * @param[out] op_p Optional pointer to the actual notification. Useful mainly for nested notifications.
  * @return LY_ERR value.
  */
-LY_ERR lyd_parse_xml_notif(const struct ly_ctx *ctx, struct ly_in *in, struct lyd_node **tree, struct lyd_node **ntf);
+LY_ERR lyd_parse_xml_notif(const struct ly_ctx *ctx, struct ly_in *in, struct lyd_node **tree_p, struct lyd_node **ntf_p);
 
 /**
  * @brief Parse XML string as YANG RPC/action reply.
@@ -367,11 +398,67 @@
  *
  * @param[in] request Data tree of the RPC/action request.
  * @param[in] in Input structure.
- * @param[out] tree Parsed full reply tree. It always includes duplicated operation and parents of the @p request.
- * @param[out] op Optional pointer to the reply operation. Useful mainly for action.
+ * @param[out] tree_p Parsed full reply tree. It always includes duplicated operation and parents of the @p request.
+ * @param[out] op_p Optional pointer to the reply operation. Useful mainly for action.
  * @return LY_ERR value.
  */
-LY_ERR lyd_parse_xml_reply(const struct lyd_node *request, struct ly_in *in, struct lyd_node **tree, struct lyd_node **op);
+LY_ERR lyd_parse_xml_reply(const struct lyd_node *request, struct ly_in *in, struct lyd_node **tree_p, struct lyd_node **op_p);
+
+/**
+ * @brief Parse JSON string as YANG data tree.
+ *
+ * @param[in] ctx libyang context
+ * @param[in] in Input structure.
+ * @param[in] parse_options Options for parser, see @ref dataparseroptions.
+ * @param[in] validate_options Options for the validation phase, see @ref datavalidationoptions.
+ * @param[out] tree_p Parsed data tree. Note that NULL can be a valid result.
+ * @param[out] lydctx_p Data parser context to finish validation.
+ * @return LY_ERR value.
+ */
+LY_ERR lyd_parse_json_data(const struct ly_ctx *ctx, struct ly_in *in, int parse_options, int validate_options,
+                           struct lyd_node **tree_p, struct lyd_ctx **lydctx_p);
+
+/**
+ * @brief Parse JSON string as YANG notification.
+ *
+ * Optional top-level "notification" envelope object, if present, is [checked](https://tools.ietf.org/html/rfc5277#page-25)
+ * and parsed. Specifically the child "eventTime" member and its value.
+ *
+ * @param[in] ctx libyang context.
+ * @param[in] in Input structure.
+ * @param[out] tree_p Parsed full notification tree.
+ * @param[out] ntf_p Optional pointer to the actual notification. Useful mainly for nested notifications.
+ * @return LY_ERR value.
+ */
+LY_ERR lyd_parse_json_notif(const struct ly_ctx *ctx, struct ly_in *in, struct lyd_node **tree_p, struct lyd_node **ntf_p);
+
+/**
+ * @brief Parse JSON string as YANG RPC/action invocation.
+ *
+ * Optional top-level "rpc" envelope object, if present is is [checked](https://tools.ietf.org/html/rfc6241#section-4.1) and the parser
+ * goes inside for the content, which is an RPC data or "action" envelope objects. The "action" envelope object is
+ * also [checked](https://tools.ietf.org/html/rfc7950#section-7.15.2) and then an action data is expected as a content of this envelope.
+ *
+ * @param[in] ctx libyang context.
+ * @param[in] in Input structure.
+ * @param[out] tree_p Parsed full RPC/action tree.
+ * @param[out] op_p Optional pointer to the actual operation. Useful mainly for action.
+ * @return LY_ERR value.
+ */
+LY_ERR lyd_parse_json_rpc(const struct ly_ctx *ctx, struct ly_in *in, struct lyd_node **tree_p, struct lyd_node **op_p);
+
+/**
+ * @brief Parse JSON string as YANG RPC/action reply.
+ *
+ * Optional "rpc-reply" envelope object, if present, is [checked](https://tools.ietf.org/html/rfc6241#section-4.2).
+ *
+ * @param[in] request Data tree of the RPC/action request.
+ * @param[in] in Input structure.
+ * @param[out] tree_p Parsed full reply tree. It always includes duplicated operation and parents of the @p request.
+ * @param[out] op_p Optional pointer to the reply operation. Useful mainly for action.
+ * @return LY_ERR value.
+ */
+LY_ERR lyd_parse_json_reply(const struct lyd_node *request, struct ly_in *in, struct lyd_node **tree_p, struct lyd_node **op_p);
 
 /**
  * @brief Parse binary data as YANG data tree.
@@ -380,44 +467,45 @@
  * @param[in] in Input structure.
  * @param[in] parse_options Options for parser, see @ref dataparseroptions.
  * @param[in] validate_options Options for the validation phase, see @ref datavalidationoptions.
- * @param[out] tree Parsed data tree. Note that NULL can be a valid result.
+ * @param[out] tree_p Parsed data tree. Note that NULL can be a valid result.
+ * @param[out] lydctx_p Data parser context to finish validation.
  * @return LY_ERR value.
  */
 LY_ERR lyd_parse_lyb_data(const struct ly_ctx *ctx, struct ly_in *in, int parse_options, int validate_options,
-                          struct lyd_node **tree);
+                          struct lyd_node **tree_p, struct lyd_ctx **lydctx_p);
 
 /**
  * @brief Parse binary data as YANG RPC/action invocation.
  *
  * @param[in] ctx libyang context.
  * @param[in] in Input structure.
- * @param[out] tree Parsed full RPC/action tree.
- * @param[out] op Optional pointer to the actual operation. Useful mainly for action.
+ * @param[out] tree_p Parsed full RPC/action tree.
+ * @param[out] op_p Optional pointer to the actual operation. Useful mainly for action.
  * @return LY_ERR value.
  */
-LY_ERR lyd_parse_lyb_rpc(const struct ly_ctx *ctx, struct ly_in *in, struct lyd_node **tree, struct lyd_node **op);
+LY_ERR lyd_parse_lyb_rpc(const struct ly_ctx *ctx, struct ly_in *in, struct lyd_node **tree_p, struct lyd_node **op_p);
 
 /**
  * @brief Parse binary data as YANG notification.
  *
  * @param[in] ctx libyang context.
  * @param[in] in Input structure.
- * @param[out] tree Parsed full notification tree.
- * @param[out] op Optional pointer to the actual notification. Useful mainly for nested notifications.
+ * @param[out] tree_p Parsed full notification tree.
+ * @param[out] ntf_p Optional pointer to the actual notification. Useful mainly for nested notifications.
  * @return LY_ERR value.
  */
-LY_ERR lyd_parse_lyb_notif(const struct ly_ctx *ctx, struct ly_in *in, struct lyd_node **tree, struct lyd_node **ntf);
+LY_ERR lyd_parse_lyb_notif(const struct ly_ctx *ctx, struct ly_in *in, struct lyd_node **tree_p, struct lyd_node **ntf_p);
 
 /**
  * @brief Parse binary data as YANG RPC/action reply.
  *
  * @param[in] request Data tree of the RPC/action request.
  * @param[in] in Input structure.
- * @param[out] tree Parsed full reply tree. It always includes duplicated operation and parents of the @p request.
- * @param[out] op Optional pointer to the reply operation. Useful mainly for action.
+ * @param[out] tree_p Parsed full reply tree. It always includes duplicated operation and parents of the @p request.
+ * @param[out] op_p Optional pointer to the reply operation. Useful mainly for action.
  * @return LY_ERR value.
  */
-LY_ERR lyd_parse_lyb_reply(const struct lyd_node *request, struct ly_in *in, struct lyd_node **tree, struct lyd_node **op);
+LY_ERR lyd_parse_lyb_reply(const struct lyd_node *request, struct ly_in *in, struct lyd_node **tree_p, struct lyd_node **op_p);
 
 /**
  * @defgroup datahash Data nodes hash manipulation
diff --git a/src/tree_schema_helpers.c b/src/tree_schema_helpers.c
index 0dd45b2..5b8c1a4 100644
--- a/src/tree_schema_helpers.c
+++ b/src/tree_schema_helpers.c
@@ -1637,7 +1637,7 @@
 /**
  * @brief Schema mapping of YANG modules to prefixes in values.
  *
- * Implementation of ly_clb_get_prefix. Inverse function to lys_resolve_prefix.
+ * Implementation of ly_get_prefix_clb. Inverse function to lys_resolve_prefix.
  *
  * In this case the @p mod is searched in the list of imports and the import's prefix
  * (not the module's itself) prefix is returned.
@@ -1664,7 +1664,7 @@
 /**
  * @brief Schema mapping of prefix in values to YANG modules (imports).
  *
- * Implementation of ly_clb_resolve_prefix. Inverse function to lys_get_prefix().
+ * Implementation of ly_resolve_prefix_clb. Inverse function to lys_get_prefix().
  *
  * In this case the @p prefix is searched in the list of imports' prefixes (not the prefixes of the imported modules themselves).
  */
diff --git a/src/tree_schema_internal.h b/src/tree_schema_internal.h
index db11a38..f6c7958 100644
--- a/src/tree_schema_internal.h
+++ b/src/tree_schema_internal.h
@@ -222,7 +222,7 @@
 /**
  * @brief Schema mapping of YANG modules to prefixes in values.
  *
- * Implementation of ly_clb_get_prefix. Inverse function to lys_resolve_prefix.
+ * Implementation of ly_get_prefix_clb. Inverse function to lys_resolve_prefix.
  *
  * In this case the @p mod is searched in the list of imports and the import's prefix
  * (not the module's itself) prefix is returned.
@@ -232,7 +232,7 @@
 /**
  * @brief Schema mapping of prefix in values to YANG modules (imports).
  *
- * Implementation of ly_clb_resolve_prefix. Inverse function to lys_get_prefix().
+ * Implementation of ly_resolve_prefix_clb. Inverse function to lys_get_prefix().
  *
  * In this case the @p prefix is searched in the list of imports' prefixes (not the prefixes of the imported modules themselves).
  */
diff --git a/src/validation.c b/src/validation.c
index 9c39173..65c64e7 100644
--- a/src/validation.c
+++ b/src/validation.c
@@ -111,7 +111,7 @@
 
 LY_ERR
 lyd_validate_unres(struct lyd_node **tree, struct ly_set *node_when, struct ly_set *node_types, struct ly_set *meta_types,
-                   LYD_FORMAT format, ly_clb_resolve_prefix get_prefix_clb, void *parser_data, struct lyd_node **diff)
+                   LYD_FORMAT format, ly_resolve_prefix_clb get_prefix_clb, void *parser_data, struct lyd_node **diff)
 {
     LY_ERR ret = LY_SUCCESS;
     uint32_t i;
@@ -172,7 +172,7 @@
             struct lyd_node_term *node = (struct lyd_node_term *)node_types->objs[i];
 
             /* validate and store the value of the node */
-            ret = lyd_value_parse(node, node->value.original, strlen(node->value.original), 0, 1, get_prefix_clb,
+            ret = lyd_value_parse(node, node->value.original, strlen(node->value.original), 0, 1, 0, get_prefix_clb,
                                   parser_data, format, *tree);
             LY_CHECK_RET(ret);
 
@@ -191,7 +191,7 @@
 
             /* validate and store the value of the metadata */
             ret = lyd_value_parse_meta(meta->parent->schema->module->ctx, meta, meta->value.original,
-                                       strlen(meta->value.original), 0, 1, get_prefix_clb, parser_data, format, NULL, *tree);
+                                       strlen(meta->value.original), 0, 1, 0, get_prefix_clb, parser_data, format, NULL, *tree);
             LY_CHECK_RET(ret);
 
             /* remove this attr from the set */
diff --git a/src/validation.h b/src/validation.h
index 41a47a5..8b23e6f 100644
--- a/src/validation.h
+++ b/src/validation.h
@@ -48,7 +48,7 @@
  * @return LY_ERR value.
  */
 LY_ERR lyd_validate_unres(struct lyd_node **tree, struct ly_set *node_when, struct ly_set *node_types, struct ly_set *meta_types,
-                          LYD_FORMAT format, ly_clb_resolve_prefix get_prefix_clb, void *parser_data, struct lyd_node **diff);
+                          LYD_FORMAT format, ly_resolve_prefix_clb get_prefix_clb, void *parser_data, struct lyd_node **diff);
 
 /**
  * @brief Validate new siblings. Specifically, check duplicated instances, autodelete default values and cases.
diff --git a/src/xml.c b/src/xml.c
index d1ba184..a3645c1 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -1103,15 +1103,15 @@
 
                     /* check whether we do not already have this prefix stored */
                     LY_ARRAY_FOR(prefixes, u) {
-                        if (!ly_strncmp(prefixes[u].pref, start, len)) {
+                        if (!ly_strncmp(prefixes[u].id, start, len)) {
                             p = &prefixes[u];
                             break;
                         }
                     }
                     if (!p) {
                         LY_ARRAY_NEW_GOTO(xmlctx->ctx, prefixes, p, ret, error);
-                        p->pref = lydict_insert(xmlctx->ctx, start, len);
-                        p->ns = lydict_insert(xmlctx->ctx, ns->uri, 0);
+                        p->id = lydict_insert(xmlctx->ctx, start, len);
+                        p->module_ns = lydict_insert(xmlctx->ctx, ns->uri, 0);
                     } /* else the prefix already present */
                 }
             }
@@ -1124,7 +1124,8 @@
 
 error:
     LY_ARRAY_FOR(prefixes, u) {
-        lydict_remove(xmlctx->ctx, prefixes[u].pref);
+        lydict_remove(xmlctx->ctx, prefixes[u].id);
+        lydict_remove(xmlctx->ctx, prefixes[u].module_ns);
     }
     LY_ARRAY_FREE(prefixes);
     return ret;
@@ -1154,9 +1155,9 @@
             if (prefs1) {
                 /* find module of the first prefix, if any */
                 LY_ARRAY_FOR(prefs1, u1) {
-                    len = strlen(prefs1[u1].pref);
-                    if (!strncmp(ptr1, prefs1[u1].pref, len) && (ptr1[len] == ':')) {
-                        ns1 = prefs1[u1].ns;
+                    len = strlen(prefs1[u1].id);
+                    if (!strncmp(ptr1, prefs1[u1].id, len) && (ptr1[len] == ':')) {
+                        ns1 = prefs1[u1].module_ns;
                         break;
                     }
                 }
@@ -1164,9 +1165,9 @@
             if (prefs2) {
                 /* find module of the second prefix, if any */
                 LY_ARRAY_FOR(prefs2, u2) {
-                    len = strlen(prefs2[u2].pref);
-                    if (!strncmp(ptr2, prefs2[u2].pref, len) && (ptr2[len] == ':')) {
-                        ns2 = prefs2[u2].ns;
+                    len = strlen(prefs2[u2].id);
+                    if (!strncmp(ptr2, prefs2[u2].id, len) && (ptr2[len] == ':')) {
+                        ns2 = prefs2[u2].module_ns;
                         break;
                     }
                 }
@@ -1178,8 +1179,8 @@
             }
 
             /* skip prefixes in both values (':' is skipped as iter) */
-            ptr1 += strlen(prefs1[u1].pref);
-            ptr2 += strlen(prefs2[u2].pref);
+            ptr1 += strlen(prefs1[u1].id);
+            ptr2 += strlen(prefs2[u2].id);
         }
 
         ++ptr1;
diff --git a/src/xml.h b/src/xml.h
index b89a283..fef0bb5 100644
--- a/src/xml.h
+++ b/src/xml.h
@@ -76,6 +76,10 @@
 };
 
 struct lyxml_ctx {
+    const struct ly_ctx *ctx;
+    uint64_t line;          /* current line */
+    struct ly_in *in;       /* input structure */
+
     enum LYXML_PARSER_STATUS status; /* status providing information about the last parsed object, following attributes
                                         are filled based on it */
     union {
@@ -95,9 +99,6 @@
         int dynamic;        /* LYXML_ELEM_CONTENT, LYXML_ATTR_CONTENT - whether elem/attr value is dynamically allocated */
     };
 
-    const struct ly_ctx *ctx;
-    uint64_t line;          /* current line */
-    struct ly_in *in;       /* input structure */
     struct ly_set elements; /* list of not-yet-closed elements */
     struct ly_set ns;       /* handled with LY_SET_OPT_USEASLIST */
 };
