Patch 8.0.0309
Problem: Cannot use an empty key in json.
Solution: Allow for using an empty key.
Files: src/json.c, src/testdir/test_json.vim
*** ../vim-8.0.0308/src/json.c 2017-01-22 15:56:21.692532206 +0100
--- src/json.c 2017-02-05 16:30:19.049590182 +0100
***************
*** 863,869 ****
&& cur_item != NULL)
{
top_item->jd_key = get_tv_string_buf_chk(cur_item, key_buf);
! if (top_item->jd_key == NULL || *top_item->jd_key == NUL)
{
clear_tv(cur_item);
EMSG(_(e_invarg));
--- 863,869 ----
&& cur_item != NULL)
{
top_item->jd_key = get_tv_string_buf_chk(cur_item, key_buf);
! if (top_item->jd_key == NULL)
{
clear_tv(cur_item);
EMSG(_(e_invarg));
*** ../vim-8.0.0308/src/testdir/test_json.vim 2017-01-14 14:36:03.229775080
+0100
--- src/testdir/test_json.vim 2017-02-05 16:30:42.945421728 +0100
***************
*** 144,149 ****
--- 144,154 ----
call assert_equal(type(v:none), type(json_decode('')))
call assert_equal("", json_decode('""'))
+ " empty key is OK
+ call assert_equal({'': 'ok'}, json_decode('{"": "ok"}'))
+ " but not twice
+ call assert_fails("call json_decode('{\"\": \"ok\", \"\": \"bad\"}')",
'E938:')
+
call assert_equal({'n': 1}, json_decode('{"n":1,}'))
call assert_fails("call json_decode(\"{'n':'1',}\")", 'E474:')
call assert_fails("call json_decode(\"'n'\")", 'E474:')
*** ../vim-8.0.0308/src/version.c 2017-02-05 16:07:50.291087646 +0100
--- src/version.c 2017-02-05 16:34:19.755896838 +0100
***************
*** 766,767 ****
--- 766,769 ----
{ /* Add new patch number below this line */
+ /**/
+ 309,
/**/
--
Beer & pretzels can't be served at the same time in any bar or restaurant.
[real standing law in North Dakota, United States of America]
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.