Code Monkey home page Code Monkey logo

defold-cjson's Introduction

Defold-CJSON

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

Platforms

  • iOS
  • Android
  • MacOS
  • Windows

Setup

You can use the Defold-CJSON extension in your own project by adding this project as a Defold library dependency. Open your game.project file and in the dependencies field under project add:

https://github.com/Melsoft-Games/defold-cjson/archive/master.zip

Or point to the ZIP file of a specific release.

API

cjson.encode(lua_table)

return encoded lua table to json string

cjson.decode(valid_json)

return parsed lua_table

Note: json must be valid, or cjson will throw error. You can wrap it with pcall, or change extension and call cjson safe_decode from lua-cjson lib

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

License, Authors

MIT license This NE wrapped by Denis Smirnov

Original module: lua-cjson License

Issues and suggestions

If you have any issues, questions or suggestions please create an issue or contact me: [email protected]

defold-cjson's People

Contributors

insality avatar familyage avatar trouble1337 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.