char_u numbuf[NUMBUFLEN];
if (res == NULL)
- ga_concat(gap, (char_u *)"null");
+ ga_concat(gap, (char_u *)"\"\"");
else
{
#if defined(FEAT_MBYTE) && defined(USE_ICONV)
case VAR_LIST:
l = val->vval.v_list;
if (l == NULL)
- ga_concat(gap, (char_u *)"null");
+ ga_concat(gap, (char_u *)"[]");
else
{
if (l->lv_copyID == copyID)
case VAR_DICT:
d = val->vval.v_dict;
if (d == NULL)
- ga_concat(gap, (char_u *)"null");
+ ga_concat(gap, (char_u *)"{}");
else
{
if (d->dv_copyID == copyID)
call assert_fails('echo json_encode(function("tr"))', 'E474:')
call assert_fails('echo json_encode([function("tr")])', 'E474:')
+ call assert_equal('{"a":""}', json_encode({'a': test_null_string()}))
+ call assert_equal('{"a":[]}', json_encode({"a": test_null_list()}))
+ call assert_equal('{"a":{}}', json_encode({"a": test_null_dict()}))
+
silent! let res = json_encode(function("tr"))
call assert_equal("", res)
endfunc