LibJSON-1.0

This project is abandoned and its default file will likely not work with the most recent version of World of Warcraft. Whether this project is out of date or its author has marked it as abandoned, this project is no longer maintained.

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.


Comments

Posts Quoted:
Reply
Clear All Quotes

About This Project

  • Project ID
    16614
  • Created
    Nov 28, 2008
  • Last Released File
    Nov 29, 2008
  • Total Downloads
    1,117
  • License

Categories

Members

Recent Files