parser json UPDATE use metadata value hints
diff --git a/src/parser_json.c b/src/parser_json.c
index cc0a2fb..7ce8f33 100644
--- a/src/parser_json.c
+++ b/src/parser_json.c
@@ -736,7 +736,7 @@
const struct ly_ctx *ctx = lydctx->jsonctx->ctx;
ly_bool is_attr = 0;
struct lyd_node *prev = node;
- uint32_t instance = 0;
+ uint32_t instance = 0, val_hints;
uint16_t nodetype;
assert(snode || node);
@@ -849,13 +849,17 @@
}
/* get the value */
- ret = lyjson_ctx_next(lydctx->jsonctx, NULL);
+ ret = lyjson_ctx_next(lydctx->jsonctx, &status);
+ LY_CHECK_GOTO(ret, cleanup);
+
+ /* get value hints */
+ ret = lydjson_value_type_hint(lydctx, &status, &val_hints);
LY_CHECK_GOTO(ret, cleanup);
if (node->schema) {
/* create metadata */
ret = lyd_parser_create_meta((struct lyd_ctx *)lydctx, node, NULL, mod, name, name_len, lydctx->jsonctx->value,
- lydctx->jsonctx->value_len, &lydctx->jsonctx->dynamic, LY_VALUE_JSON, NULL, LYD_HINT_DATA, node->schema);
+ lydctx->jsonctx->value_len, &lydctx->jsonctx->dynamic, LY_VALUE_JSON, NULL, val_hints, node->schema);
LY_CHECK_GOTO(ret, cleanup);
/* add/correct flags */
@@ -871,7 +875,7 @@
/* attr2 is always changed to the created attribute */
ret = lyd_create_attr(node, NULL, lydctx->jsonctx->ctx, name, name_len, prefix, prefix_len, module_name,
module_name_len, lydctx->jsonctx->value, lydctx->jsonctx->value_len, &lydctx->jsonctx->dynamic,
- LY_VALUE_JSON, NULL, 0);
+ LY_VALUE_JSON, NULL, val_hints);
LY_CHECK_GOTO(ret, cleanup);
}
/* next member */