Defold CJSON
Defold NE for cjson encode and decode JSON
Defold-CJSON Native Extension for the Defold Game Engine
This extension allow you encode lua table to JSON and decode JSON to lua table in native part.
Short API:
cjson.encode(lua_table)
- return encoded lua table to json string
cjson.decode(valid_json)
- return parsed lua_table
Examples you can find in GitHub repository
Benchmark
rxlua - pure lua JSON encode/decode implementation
time in ms
Json: | 4KB | 971KB | 1.8MB |
---|---|---|---|
defold decode | 0 | 0.032 | 0.075 |
β | β | β | β |
rxlua encode | 0 | 0.0734 | 0.148 |
rxlua decode | 0.0003 | 0.0308 | 0.051 |
β | β | β | β |
cjson encode | 0 | 0.0057 | 0.0122 |
cjson decode | 0 | 0.0066 | 0.0117 |
Notes
This is extension, what we use in Family Age
If you will use our extension and find some bugs or have some suggestions, you are welcome, tell about it!
NE wrapped by @denis.smirnov.by