{"id":13494740,"url":"https://github.com/xpol/lua-rapidjson","last_synced_at":"2025-04-06T17:11:57.119Z","repository":{"id":28997018,"uuid":"32523896","full_name":"xpol/lua-rapidjson","owner":"xpol","description":"A JSON module for Lua based on the very fast RapidJSON library.","archived":false,"fork":false,"pushed_at":"2022-09-15T08:33:43.000Z","size":1751,"stargazers_count":282,"open_issues_count":11,"forks_count":66,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-03-30T15:11:11.100Z","etag":null,"topics":["lua","rapidjson"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xpol.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-19T13:46:29.000Z","updated_at":"2025-03-13T07:16:31.000Z","dependencies_parsed_at":"2022-08-07T14:01:03.453Z","dependency_job_id":null,"html_url":"https://github.com/xpol/lua-rapidjson","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xpol%2Flua-rapidjson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xpol%2Flua-rapidjson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xpol%2Flua-rapidjson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xpol%2Flua-rapidjson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xpol","download_url":"https://codeload.github.com/xpol/lua-rapidjson/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247517914,"owners_count":20951719,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lua","rapidjson"],"created_at":"2024-07-31T19:01:27.668Z","updated_at":"2025-04-06T17:11:57.098Z","avatar_url":"https://github.com/xpol.png","language":"C++","readme":"# RapidJSON bindings for Lua\n\n[![License](http://img.shields.io/badge/License-MIT-brightgreen.svg)](LICENSE)\n[![Badge][]][Actions]\n\n\nA json module for LuaJIT 2.0/2.1 and Lua 5.1/5.2/5.3,\nbased on the very fast [RapidJSON][] C++ library.\n\nSee project [homepage][] for more information,\nbug report and feature request.\n\n## Dependencies\n\n* lua development environment\n    * `lua-devel` (linux) \n    * or [luavm](https://github.com/xpol/luavm)(windows)\n    * or `brew install lua luarocks` \n    * or any equivalent on your system\n* `cmake` \u003e= `3.1.0`, cmake 2.8 may work but not well tested.\n\n## Usage\n\n    luarocks install rapidjson\n\nor if you like to use your own version of RapidJSON, use:\n\n    luarocks install rapidjson RAPIDJSON_INCLUDE_DIRS=path/to/rapidjson/include/dir\n\n```Lua\nlocal rapidjson = require('rapidjson')\n\nrapidjson.encode()\nrapidjson.decode()\n\nrapidjson.load()\nrapidjson.dump()\n```\n\n### Usage without luarocks\n\n1. Use `cmake -H. -Bbuild -G\u003cgenerator-name\u003e` go generate project.\n\n    *If you use a non standard lua install location, add environment variable `LUA_DIR` to the directory contains `include` and `lib` for you lua installation. eg.*\n\n        LUA_DIR=/usr/local/openresty/luajit cmake -H. -Bbuild -G\u003cgenerator-name\u003e\n\n2. `cmake --build build --config Release` to build the `rapidjosn.so` or `rapidjosn.dll` library.\n\n3. Then link that library to you project or copy to desired place.\n\n\u003e Tips: use `cmake --help` to see a list of generator-name available.\n\n## Value Type Mappings\n\nLua Type          | JSON type    | Notes\n------------------|--------------|----------------------\n`rapidjson.null`  |`null`        |\n`true`            |`true`        |\n`false`           |`false`       |\nstring            |string        |\ntable             |array         |when meta field `__jsontype` is `'array'` or no `__jsontype` meta filed and table length \u003e 0 or table length == 0 and empty_table_as_array option is specified\ntable             |object        |when not an array, all non string keys and its values are ignored.\nnumber            |number        |\n\n## Test\n\nClone or download source code, in the project root folder:\n\n    luarocks install luautf8\n    luarocks install busted\n    luarocks make\n    busted\n\n## Performance\n\nTo compare speed of rapidjson and other json libraries:\n\n    lua performance/run.lua\n\nThe result on my Macbook Pro shows:\n - For decoding, lua-rapidjson is slightly faster than lua-cjson in most cases.\n - For encoding, lua-rapidjson is always faster than lua-cjson, and much faster when encoding numbers.\n\n## API\n\nSee [API reference](API.md).\n\n## Release Steps\n\n1. Pass all unit tests.\n2. Update version in rapidjson-*.*.*-1.rockspec and update the name of the rockspec file.\n3. Tag source code with that version (v*.*.*), and push.\n4. `luarocks upload rapidjson-*.*.*-1.rockspec`\n\n## Changelog\n\n### 0.7.0\n\n* Change the `rapidjson.null` type to lightuserdata and fixes the issue when it accessed by different Lua States.\n\n### 0.6.1\n\n* Try support cmake 2.8 with GCC (but still requires c++ compiler support c++11 or at least c++0x).\n\n### 0.6.0\n\n* Add support for decode C buffer + length.\n* Export C++ API `pushDecoded`.\n\n### 0.5.2\n\n* Check lua stack when decoding objects and arrays to ensure there is room (Thanks Matthew Johnson).\n\n### 0.5.1\n\n* Remove all c++11 feature requirements except move constructor.\n\n### 0.5.0\n\n* Added Document SchemaDocument SchemaValidator to support JSON pointer and schema.\n\n### 0.4.5\n\n* Checks encoding error for float point numbers.\n* RapidJSON compiling turn: use release config and turn SIMD on if supported.\n\n### 0.4.4\n\n* Fixes build and test errors introduced in 0.4.3.\n\n### 0.4.3\n\n* CMakeLists.txt supports command line defined `RAPIDJSON_INCLUDE_DIRS` to specified RapidJSON include directory.\n* Keeps only necessary RapidJSON header files and docs make the rock much smaller.\n\n### 0.4.2\n\n* Update RapidJSON to latest HEAD version.\n\n### 0.4.1\n\n* Fixes Windows dll.\n\n### 0.4.0\n\n* Checks circular reference when encoding tables.\n* A table is encoded as json array if:\n  - have meta field `__jsontype` set to `'array'`.\n  - don't have meta filed `__jsontype` and length \u003e 0.\n* When table is encoded as json object, **only string keys and its values are encoded**.\n* Integers are decoded to lua_Integer if it can be stored in lua_Integer.\n\n### 0.3.0\n\n* Follow integers are encoded as integers.\n  - Lua 5.3 integers.\n  - Integers stored in double and in between:\n    - [INT64_MIN..INT64_MAX] on 64 bit Lua or\n    - [INT32_MIN..INT32_MAX] in 32 bit Lua.\n* CI scripts updated, thanks @ignacio\n\n### 0.2.0\n\n* Rename module to `rapidjson`.\n* Added `option.sort_keys` option to `rapidjson.encode()` and `rapidjson.dump()`, and default value for `sort_keys` is `false`.\n* Added `rapidjson._NAME` (`\"rapidjson\"`) and `rapidjson._VERSION`.\n* `rapidjson.object()` and `rapidjson.array()` just set metatable field `__jsontype` to `'object'` and `'array'` if passed table already have a metatable.\n* fixes dump return value of `false` rather than `nil`.\n\n### 0.1.0\n\n* Initial release.\n\n\n[RapidJSON]: https://github.com/miloyip/rapidjson\n[homepage]: https://github.com/xpol/lua-rapidjson\n[Badge]: https://github.com/xpol/lua-rapidjson/workflows/CI/badge.svg\n[Actions]: https://github.com/xpol/lua-rapidjson/actions?workflow=CI\n","funding_links":[],"categories":["C++"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxpol%2Flua-rapidjson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxpol%2Flua-rapidjson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxpol%2Flua-rapidjson/lists"}