lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

lua-rapidjson[1] 0.5.0 is released!

lua-rapidjson is a JSON module based on the very fast RapidJSON[2] library.
The RapidJSON has recently add support for JSON Pointer[3] and JSON Schema[4].

So lua-rapidjson has add these features.

New:

- Added rapidjson.Document, doc:get() and doc:set() is based on JSON Pointer.
- Added rapidjson.SchemaDocument and rapidjson.SchemaValidator for JSON Schema support.

Improved:

- Performance improvements (thanks RapidJSON), now the performance of lua-rapidjson is even better than lua-cjson (Tested on mac mini late 2012 with luajit 2.1.0-beta2 ).


Install:
> luarocks install rapidjson

New feature usage at a glance:

-- JSON pointer
local d = rapidjson.Document({a= {"b", "c"}})
assert(d:set('/a/0') == "b")
d:set('/a/0', 'd')

-- JSON Schema
local schema = rapidjson.SchemaDocument({ type= {"number", "string"} })
local validator = rapidjson.SchemaValidator(schema)

assert(validator:validate(rapidjson.Document('42')))
assert(not validator:validate(rapidjson.Document('{"a": "b"}')))

Detailed API reference can be found at https://github.com/xpol/lua-rapidjson/blob/master/API.md

Starts, Forks, Issues and Pull-requests are welcomed at Github Project Page[1]

[1] https://github.com/xpol/lua-rapidjson
[2] http://rapidjson.org/
[3] http://rapidjson.org/md_doc_pointer.html
[4] http://rapidjson.org/md_doc_schema.html