Skip to content
An attempt at unifying lua JSON implementations to provide a common API with modules
Lua
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE
README.md
cjson.lua
default.lua
init.lua

README.md

What is JsonCommons2

It's the same goal than ClassCommons2 but focused on the JSON implementations and their API.

Goal of JsonCommons2

  • be able to load one or more json implementation at a time
  • define and use a common API
  • NEVER modify the global environment.

Unified API

Note: it's a draft

I planned to mainly use the :

  • common.encodei
  • common.decode
  • common.null
  • (maybe also support the common.stringify and common.parseJSON for backward compatibility)

Sample of use

local common = require("jsoncommons2")
local encode = common.encode
local decode = common.decode

By default the CJSON implementation was used. You can choose the default with :

require("jsoncommons2.default").name = "cjson"

local common = require("jsoncommons2")
local encode = common.encode
local decode = common.decode

or load directly the wanted implementation with

local common = require("jsoncommons2.cjson")
local encode = common.encode
local decode = common.decode

Supported implementation

Why use CJSON as default ?

  • because it was fast. See benchmarks.
  • because it was available on my computer when I started jsoncommons2 !

TODO

  • fill the todo list
  • ...

Have Fun !

You can’t perform that action at this time.