json_decode_item(js_read_T *reader, typval_T *res, int options)
{
char_u *p;
+ int i;
int len;
int retval;
garray_T stack;
if (*p == NUL)
{
retval = MAYBE;
- if (top_item->jd_type == JSON_OBJECT)
- // did get the key, clear it
- clear_tv(&top_item->jd_key_tv);
goto theend;
}
if (top_item->jd_type == JSON_OBJECT_KEY
top_item->jd_key = tv_get_string_buf_chk(cur_item, key_buf);
if (top_item->jd_key == NULL)
{
- clear_tv(cur_item);
emsg(_(e_invarg));
retval = FAIL;
goto theend;
{
semsg(_("E938: Duplicate key in JSON: \"%s\""),
top_item->jd_key);
- clear_tv(&top_item->jd_key_tv);
clear_tv(cur_item);
retval = FAIL;
goto theend;
semsg(_(e_json_error), p);
theend:
+ for (i = 0; i < stack.ga_len; i++)
+ clear_tv(&(((json_dec_item_T *)stack.ga_data) + i)->jd_key_tv);
ga_clear(&stack);
+
return retval;
}
call assert_fails('call json_decode("\"\\u111Z\"")', 'E491:')
call assert_equal('[😂]', json_decode('"[\uD83D\uDE02]"'))
call assert_equal('a😂b', json_decode('"a\uD83D\uDE02b"'))
+
+ call assert_fails('call json_decode("{\"\":{\"\":{")', 'E491:')
endfunc
let s:jsl5 = '[7,,,]'