LibJSON-1.0

This project is abandoned.

Whether this project is out of date or its author marked it as abandoned, this project is no longer maintained.

If you wish to take this project over, please report it and state your intentions.

LibJSON-1.0 is a library to convert between Lua objects and serialized JSON objects

This is mostly useful if you are exporting lua data to external applications.

local LibJSON = LibStub("LibJSON-1.0")

local myObject = {
    alpha = "Hello",
    bravo = {1234, 5678.9},
    charlie = {delta = "echo"},
    delta = LibJSON.Null()
}

local json = LibJSON.Serialize(myObject)
assert(json == [=[{"alpha":"Hello","bravo":[1234,5678.9],"charlie":{"delta":"echo"},"delta":null}]=])

-- and deserializing
local lua = LibJSON.Deserialize([=[{
    "alpha": "Hello",
    "bravo": [1234, 5678],
    "charlie": {"delta": "echo"},
    "delta": null
}]=])
assert(lua.charlie.delta == "echo")
assert(lua.bravo[2] == 5678.9)

UTF-8 strings up to U+FFFF are fully supported.

You must login to post a comment. Don't have an account? Register to get one!

Facts

Date created
Nov 29, 2008
Category
Last update
Apr 05, 2009
Development stage
Abandoned
License
MIT License
Downloads
826
Recent files

Authors