diff runtime/doc/eval.txt @ 8275:ff900e499f79 v7.4.1430

commit https://github.com/vim/vim/commit/7ce686c990ea8c490d16be7f1c6bd95eb48816f9 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Feb 27 16:33:22 2016 +0100 patch 7.4.1430 Problem: When encoding JSON, turning NaN and Infinity into null without giving an error is not useful. Solution: Pass NaN and Infinity on. If the receiver can't handle them it will generate the error.
author Christian Brabandt <cb@256bit.org>
date Sat, 27 Feb 2016 16:45:04 +0100
parents 989ac3aed1ef
children e05e28dcb590
line wrap: on
line diff
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1,4 +1,4 @@
-*eval.txt*	For Vim version 7.4.  Last change: 2016 Feb 23
+*eval.txt*	For Vim version 7.4.  Last change: 2016 Feb 27
 
 
 		  VIM REFERENCE MANUAL	  by Bram Moolenaar
@@ -4561,6 +4561,8 @@ json_encode({expr})					*json_encode()*
 		Vim values are converted as follows:
 		   Number		decimal number
 		   Float		floating point number
+		   Float nan		"NaN"
+		   Float inf		"Infinity"
 		   String		in double quotes (possibly null)
 		   Funcref		not possible, error
 		   List			as an array (possibly null); when
@@ -4571,13 +4573,9 @@ json_encode({expr})					*json_encode()*
 		   v:true		"true"
 		   v:none		"null"
 		   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.
+		Note that NaN and Infinity are passed on as values.  This is
+		missing in the JSON standard, but several implementations do
+		allow it.  If not then you will get an error.
 
 keys({dict})						*keys()*
 		Return a |List| with all the keys of {dict}.  The |List| is in