To: vim_dev@googlegroups.com Subject: Patch 7.4.1188 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1188 Problem: Using older JSON standard. Solution: Update the link. Adjust the text a bit. Files: src/json.c, runtime/doc/eval.txt *** ../vim-7.4.1187/src/json.c 2016-01-24 16:49:06.227712998 +0100 --- src/json.c 2016-01-27 22:10:15.360655730 +0100 *************** *** 10,16 **** /* * json.c: Encoding and decoding JSON. * ! * Follows this standard: http://www.ietf.org/rfc/rfc4627.txt */ #include "vim.h" --- 10,16 ---- /* * json.c: Encoding and decoding JSON. * ! * Follows this standard: https://tools.ietf.org/html/rfc7159.html */ #include "vim.h" *** ../vim-7.4.1187/runtime/doc/eval.txt 2016-01-23 19:45:48.626931291 +0100 --- runtime/doc/eval.txt 2016-01-28 14:07:23.081943303 +0100 *************** *** 4164,4180 **** The opposite function is |split()|. jsondecode({string}) *jsondecode()* ! TODO jsonencode({expr}) *jsonencode()* ! Encodode {expr} as JSON and return this as a string. The encoding is specified in: ! http://www.ietf.org/rfc/rfc4627.txt Vim values are converted as follows: Number decimal number Float floating point number String in double quotes (possibly null) ! Funcref nothing List as an array (possibly null); when used recursively: [] Dict as an object (possibly null); when --- 4248,4278 ---- The opposite function is |split()|. jsondecode({string}) *jsondecode()* ! This parses a JSON formatted string and returns the equivalent ! in Vim values. See |jsonencode()| for the relation between ! JSON and Vim values. ! The decoding is permissive: ! - A trailing comma in an array and object is ignored. ! - An empty item in an array, two commas with nothing or white ! space in between, results in v:none. ! - When an object member name is not a string it is converted ! to a string. E.g. the number 123 is used as the string ! "123". ! - More floating point numbers are recognized, e.g. "1." for ! "1.0". ! The result must be a valid Vim type: ! - An empty object member name is not allowed. ! - Duplicate object member names are not allowed. jsonencode({expr}) *jsonencode()* ! Encode {expr} as JSON and return this as a string. The encoding is specified in: ! https://tools.ietf.org/html/rfc7159.html Vim values are converted as follows: Number decimal number Float floating point number String in double quotes (possibly null) ! Funcref not possible, error List as an array (possibly null); when used recursively: [] Dict as an object (possibly null); when *************** *** 4183,4188 **** --- 4281,4293 ---- v:true "true" v:none nothing v:null "null" + Note that using v:none is permitted, although the JSON + standard does not allow empty items. This can be useful for + omitting items in an array: + [0,,,,,5] ~ + This is much more efficient than: + [0,null,null,null,null,5] ~ + But a strict JSON parser will not accept it. keys({dict}) *keys()* Return a |List| with all the keys of {dict}. The |List| is in *** ../vim-7.4.1187/src/version.c 2016-01-27 21:08:12.527796721 +0100 --- src/version.c 2016-01-28 14:10:17.792150866 +0100 *************** *** 748,749 **** --- 748,751 ---- { /* Add new patch number below this line */ + /**/ + 1188, /**/ -- ERROR 047: Keyboard not found. Press RETURN to continue. /// Bram Moolenaar -- Bram@Moolenaar.net -- 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 ///