Commit 86e5afd3 authored by seny's avatar seny
Browse files

Fix docs

parent 99e6ae99
JSON encoding/decoding library for Lua JSON encoding/decoding library for Lua
====================================== ======================================
[lua-json] provides the following API: [lua-json] provides fast JSON encoding/decoding routines for Lua:
- Support for inline data transformation/filtering via metamethods/handlers.
- Properly protected against memory allocation errors.
- No external dependencies.
- Written in C.
### json.encode(value, [event]) ### json.encode(value, [event])
Returns a text string containing a JSON representation of `value`. Optional `event` may be used Returns a text string containing a JSON representation of `value`. Optional `event` may be used
...@@ -115,12 +120,11 @@ assert(tostring(encode_decode(obj, '__toB', fromB)) == 'b') ...@@ -115,12 +120,11 @@ assert(tostring(encode_decode(obj, '__toB', fromB)) == 'b')
``` ```
Extended JSON Non-standard numeric values
------------- ---------------------------
[lua-json] accepts non-standard numeric values `[-]nan`, `[-]NaN`, `[-]inf`, `[-]Infinity` when encoding [lua-json] supports the following values in JSON: `[-]nan`, `[-]NaN`, `[-]inf`, `[-]Infinity`.
or decoding (if supported by the system). It also recognizes numbers prefixed with `0x` as hexadecimal It also recognizes numbers prefixed with `0x` as hexadecimal.
when decoding.
If strictly compliant JSON generation is preferred, the following technique may be used to filter out If strictly compliant JSON generation is preferred, the following technique may be used to filter out
these values: these values:
...@@ -140,14 +144,14 @@ end ...@@ -140,14 +144,14 @@ end
local mt = {__toJSON = check} local mt = {__toJSON = check}
local t = { local t = {
good = 1.234, val = 1.234,
nan = 0/0, nan = 0/0,
inf = 1/0, inf = 1/0,
ninf = -1/0, ninf = -1/0,
} }
local s = [[{ local s = [[{
"good": 1.234, "val": 1.234,
"nan": nan, "nan": nan,
"inf": inf, "inf": inf,
"ninf": -inf "ninf": -inf
......
...@@ -5,6 +5,13 @@ source = { ...@@ -5,6 +5,13 @@ source = {
} }
description = { description = {
summary = 'JSON encoding/decoding library for Lua', summary = 'JSON encoding/decoding library for Lua',
detailed = [[
lua-json provides fast JSON encoding/decoding routines for Lua:
- Support for inline data transformation/filtering via metamethods/handlers.
- Properly protected against memory allocation errors.
- No external dependencies.
- Written in C.
]],
license = 'MIT', license = 'MIT',
homepage = 'https://github.com/neoxic/lua-json', homepage = 'https://github.com/neoxic/lua-json',
maintainer = 'Arseny Vakhrushev <arseny.vakhrushev@gmail.com>', maintainer = 'Arseny Vakhrushev <arseny.vakhrushev@gmail.com>',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment