Commit 13c9723d authored by seny's avatar seny
Browse files

Fix docs

parent 2a6d96c8
JSON encoding/decoding library for Lua JSON encoding/decoding module for Lua
====================================== =====================================
[lua-json] provides fast JSON encoding/decoding routines for Lua: [lua-json] provides fast JSON encoding/decoding routines for Lua:
- Support for inline data transformation/filtering via metamethods/handlers. - Support for inline data transformation/filtering via metamethods/handlers.
- Properly protected against memory allocation errors. - Written in C with 32/64-bit awareness.
- No external dependencies. - No external dependencies.
- Written in C.
### json.encode(value, [event]) ### json.encode(value, [event])
...@@ -119,11 +118,11 @@ assert(tostring(encode_decode(obj, '__toB', fromB)) == 'b') ...@@ -119,11 +118,11 @@ assert(tostring(encode_decode(obj, '__toB', fromB)) == 'b')
``` ```
Non-standard numeric values Non-standard JSON values
--------------------------- ------------------------
[lua-json] supports the following values in JSON: `[-]nan`, `[-]NaN`, `[-]inf`, `[-]Infinity`. [lua-json] recognizes numbers prefixed with `0x` as hexadecimal. It also supports the following values:
It also recognizes numbers prefixed with `0x` as hexadecimal. `[-]nan`, `[-]NaN`, `[-]inf`, `[-]Infinity`.
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:
...@@ -134,7 +133,7 @@ local json = require 'json' ...@@ -134,7 +133,7 @@ local json = require 'json'
local function filter(t) local function filter(t)
for k, v in pairs(t) do for k, v in pairs(t) do
if v ~= v or v == 1/0 or v == -1/0 then if v ~= v or v == 1/0 or v == -1/0 then
error(("invalid value '%f' at index '%s'"):format(v, k)) error(("non-standard value '%f' at index '%s'"):format(v, k))
end end
end end
return t return t
......
...@@ -4,13 +4,12 @@ source = { ...@@ -4,13 +4,12 @@ source = {
url = 'git://github.com/neoxic/lua-json.git', url = 'git://github.com/neoxic/lua-json.git',
} }
description = { description = {
summary = 'JSON encoding/decoding library for Lua', summary = 'JSON encoding/decoding module for Lua',
detailed = [[ detailed = [[
lua-json provides fast JSON encoding/decoding routines for Lua: lua-json provides fast JSON encoding/decoding routines for Lua:
- Support for inline data transformation/filtering via metamethods/handlers. - Support for inline data transformation/filtering via metamethods/handlers.
- Properly protected against memory allocation errors. - Written in C with 32/64-bit awareness.
- No external dependencies. - No external dependencies.
- Written in C.
]], ]],
license = 'MIT', license = 'MIT',
homepage = 'https://github.com/neoxic/lua-json', homepage = 'https://github.com/neoxic/lua-json',
......
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