commit d215dae0e0908d464d70e5645f3e2690bd9caf60 parent 4aec442b5af5a1a7c3aa47626fee09452117575e Author: Christian Clason <c.clason@uni-graz.at> Date: Tue, 27 Dec 2022 13:22:33 +0100 docs(lua): add `vim.json` (#21538) Diffstat:
| M | runtime/doc/lua.txt | | | 16 | ++++++++++++++++ |
1 file changed, 16 insertions(+), 0 deletions(-)
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt @@ -715,6 +715,22 @@ vim.mpack.decode({str}) *vim.mpack.decode* Decodes (or "unpacks") the msgpack-encoded {str} to a Lua object. ------------------------------------------------------------------------------ +VIM.JSON *lua-json* + +The *vim.json* module provides encoding and decoding of Lua objects to and +from JSON-encoded strings. Supports |vim.NIL| and |vim.empty_dict()|. + +vim.json.encode({obj}) *vim.json.encode* + Encodes (or "packs") Lua object {obj} as JSON in a Lua string. + +vim.json.decode({str}[, {opts}]) *vim.json.decode* + Decodes (or "unpacks") the JSON-encoded {str} to a Lua object. + + {opts} is a table with the key `luanil = { object: bool, array: bool }` + that controls whether `null` in JSON objects or arrays should be converted + to Lua `nil` instead of `vim.NIL`. + +------------------------------------------------------------------------------ VIM.SPELL *lua-spell* vim.spell.check({str}) *vim.spell.check()*