aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/_meta/json.lua
diff options
context:
space:
mode:
authorGregory Anders <8965202+gpanders@users.noreply.github.com>2023-09-14 08:23:01 -0500
committerGitHub <noreply@github.com>2023-09-14 08:23:01 -0500
commit2e92065686f62851318150a315591c30b8306a4b (patch)
tree3d4d216f7b031cd2e966380f9b32d1aae472d32f /runtime/lua/vim/_meta/json.lua
parent9fc321c9768d1a18893e14f46b0ebacef1be1db4 (diff)
downloadrneovim-2e92065686f62851318150a315591c30b8306a4b.tar.gz
rneovim-2e92065686f62851318150a315591c30b8306a4b.tar.bz2
rneovim-2e92065686f62851318150a315591c30b8306a4b.zip
docs: replace <pre> with ``` (#25136)
Diffstat (limited to 'runtime/lua/vim/_meta/json.lua')
-rw-r--r--runtime/lua/vim/_meta/json.lua37
1 files changed, 18 insertions, 19 deletions
diff --git a/runtime/lua/vim/_meta/json.lua b/runtime/lua/vim/_meta/json.lua
index 76a6c7b733..edf905c7c6 100644
--- a/runtime/lua/vim/_meta/json.lua
+++ b/runtime/lua/vim/_meta/json.lua
@@ -1,8 +1,8 @@
---- @meta
+---@meta
-- luacheck: no unused args
---- @defgroup vim.json
+---@defgroup vim.json
---
--- This module provides encoding and decoding of Lua objects to and
--- from JSON-encoded strings. Supports |vim.NIL| and |vim.empty_dict()|.
@@ -14,24 +14,23 @@
--- - Decodes empty array as `{}` (empty Lua table).
---
--- Example:
---- <pre>lua
---- :lua vim.print(vim.json.decode('{"bar":[],"foo":{},"zub":null}'))
---- --> { bar = {}, foo = vim.empty_dict(), zub = vim.NIL }
---- </pre>
---- Parameters: ~
---- • {str} Stringified JSON data.
---- • {opts} Options map keys:
---- • luanil: { object: bool, array: bool }
---- • `luanil.object=true` converts `null` in JSON objects to
---- Lua `nil` instead of `vim.NIL`.
---- • `luanil.array=true` converts `null` in JSON arrays to Lua
---- `nil` instead of `vim.NIL`.
---- @param str string
---- @param opts? table<string, any>
---- @return any
+---
+--- ```lua
+--- vim.print(vim.json.decode('{"bar":[],"foo":{},"zub":null}'))
+--- -- { bar = {}, foo = vim.empty_dict(), zub = vim.NIL }
+--- ```
+---
+---@param str string Stringified JSON data.
+---@param opts? table<string,any> Options table with keys:
+--- - luanil: (table) Table with keys:
+--- * object: (boolean) When true, converts `null` in JSON objects
+--- to Lua `nil` instead of |vim.NIL|.
+--- * array: (boolean) When true, converts `null` in JSON arrays
+--- to Lua `nil` instead of |vim.NIL|.
+---@return any
function vim.json.decode(str, opts) end
--- Encodes (or "packs") Lua object {obj} as JSON in a Lua string.
---- @param obj any
---- @return string
+---@param obj any
+---@return string
function vim.json.encode(obj) end