diff options
| author | Albert Krewinkel <[email protected]> | 2024-05-05 00:25:29 +0200 |
|---|---|---|
| committer | Albert Krewinkel <[email protected]> | 2024-05-05 00:25:29 +0200 |
| commit | 32f0ed9ea3600629de4d74f1841c73502da5baa8 (patch) | |
| tree | 7e0ed9f7233318acc9b61b4c531a741368de01fd /doc | |
| parent | 1a15c9f6a938e62bd6778a0b0c86f5f851b5772b (diff) | |
Lua: improve `pandoc.json.decode` docs.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lua-filters.md | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/doc/lua-filters.md b/doc/lua-filters.md index 3e3edbcb9..208a2054f 100644 --- a/doc/lua-filters.md +++ b/doc/lua-filters.md @@ -4686,11 +4686,14 @@ Value used to represent the `null` JSON value. (light userdata) `decode (str[, pandoc_types])` -Creates a Lua object from a JSON string. The function returns an -[Inline], [Block], [Pandoc], [Inlines], or [Blocks] element if the -input can be decoded into represent any of those types. Otherwise -the default decoding is applied, using tables, booleans, numbers, -and [null] to represent the JSON value. +Creates a Lua object from a JSON string. If the input can be +decoded as representing an [Inline], [Block], [Pandoc], [Inlines], +or [Blocks] element the function will return an object of the +appropriate type. Otherwise, if the input does not represent any +of the AST types, the default decoding is applied: Objects and +arrays are represented as tables, the JSON `null` value becomes +[null], and JSON booleans, strings, and numbers are converted +using the Lua types of the same name. The special handling of AST elements can be disabled by setting `pandoc_types` to `false`. @@ -4718,7 +4721,7 @@ Encodes a Lua object as JSON string. If the object has a metamethod with name `__tojson`, then the result is that of a call to that method with `object` passed as the sole argument. The result of that call is expected to be a -valid JSON string, but this not checked. +valid JSON string, but this is not checked. Parameters: |
