aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2016-01-30 22:25:21 +0300
committerZyX <kp-pav@yandex.ru>2016-04-18 02:44:03 +0300
commit68e58444b48fc34c9a7c262883750778fbd935d7 (patch)
treee70c3cbc8ae375c34498c30620571b1deb5e3099 /runtime
parentc3efad5398da01fcdb0fd40822bedff4957c7797 (diff)
downloadrneovim-68e58444b48fc34c9a7c262883750778fbd935d7.tar.gz
rneovim-68e58444b48fc34c9a7c262883750778fbd935d7.tar.bz2
rneovim-68e58444b48fc34c9a7c262883750778fbd935d7.zip
eval: Add jsonencode() function
Ref #3471
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/eval.txt14
1 files changed, 14 insertions, 0 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index cf1394d799..2d08afff4f 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1932,6 +1932,7 @@ jobstart( {cmd}[, {opts}]) Number Spawns {cmd} as a job
jobstop( {job}) Number Stops a job
jobwait( {ids}[, {timeout}]) Number Wait for a set of jobs
join( {list} [, {sep}]) String join {list} items into one String
+jsonencode( {expr}) String Convert {expr} to JSON
keys( {dict}) List keys in {dict}
len( {expr}) Number the length of {expr}
libcall( {lib}, {func}, {arg}) String call {func} in library {lib} with {arg}
@@ -4291,6 +4292,19 @@ join({list} [, {sep}]) *join()*
converted into a string like with |string()|.
The opposite function is |split()|.
+jsonencode({expr}) *jsonencode()*
+ Convert {expr} into a JSON string. Accepts
+ |msgpack-special-dict| as the input. Will not convert
+ |Funcref|s, mappings with non-string keys (can be created as
+ |msgpack-special-dict|), values with self-referencing
+ containers, strings which contain non-UTF-8 characters,
+ pseudo-UTF-8 strings which contain codepoints reserved for
+ surrogate pairs (such strings are not valid UTF-8 strings).
+ When converting 'encoding' is taken into account, if it is not
+ "utf-8", then conversion is performed before encoding strings.
+ Non-printable characters are converted into "\u1234" escapes
+ or special escapes like "\t", other are dumped as-is.
+
keys({dict}) *keys()*
Return a |List| with all the keys of {dict}. The |List| is in
arbitrary order.