Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
Lua Json
Commits
86e5afd3
Commit
86e5afd3
authored
May 11, 2019
by
seny
Browse files
Fix docs
parent
99e6ae99
Changes
2
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
86e5afd3
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])
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')
```
Extended JSON
-------------
Non-standard numeric values
-------------
--------------
[lua-json] accepts non-standard numeric values
`[-]nan`
,
`[-]NaN`
,
`[-]inf`
,
`[-]Infinity`
when encoding
or decoding (if supported by the system). It also recognizes numbers prefixed with
`0x`
as hexadecimal
when decoding.
[lua-json] supports the following values in JSON:
`[-]nan`
,
`[-]NaN`
,
`[-]inf`
,
`[-]Infinity`
.
It also recognizes numbers prefixed with
`0x`
as hexadecimal.
If strictly compliant JSON generation is preferred, the following technique may be used to filter out
these values:
...
...
@@ -140,14 +144,14 @@ end
local mt = {__toJSON = check}
local t = {
good
= 1.234,
val
= 1.234,
nan = 0/0,
inf = 1/0,
ninf = -1/0,
}
local s = [[{
"
good
": 1.234,
"
val
": 1.234,
"nan": nan,
"inf": inf,
"ninf": -inf
...
...
rockspec/lua-json-git-1.rockspec
View file @
86e5afd3
...
...
@@ -5,6 +5,13 @@ source = {
}
description
=
{
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'
,
homepage
=
'https://github.com/neoxic/lua-json'
,
maintainer
=
'Arseny Vakhrushev <arseny.vakhrushev@gmail.com>'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment