The example given at line 4401 of eval.txt is incorrect: the statement
:echo jsencode([1, v:none, {"one":1}], v:none)
gives error E118: Too many arguments for function: jsencode
followed by E15: Invalid expression
The closing square bracket for the List should immediately precede the
closing round bracket for jsencode().
Patch attached.
Best regards,
Tony.
--
--
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.
# HG changeset patch
# User Tony Mechelynck <[email protected]>
# Parent 791f4657b5fcc7c1934d87e6bef1477fdc1ed0fa
documentation error about jsencode()
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -4393,17 +4393,17 @@ jsdecode({string})
*jsdecode()*
result in v:none items.
jsencode({expr}) *jsencode()*
This is similar to |jsonencode()| with these differences:
- Object key names are not in quotes.
- v:none items in an array result in an empty item between
commas.
For example, the Vim object:
- [1,v:none,{"one":1}],v:none ~
+ [1,v:none,{"one":1},v:none] ~
Will be encoded as:
[1,,{one:1},,] ~
While jsonencode() would produce:
[1,null,{"one":1},null] ~
This encoding is valid for JavaScript. It is more efficient
than JSON, especially when using an array with optional items.