lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


dkjson is a module for encoding and decoding JSON data. It supports UTF-8.

JSON (JavaScript Object Notation) is a format for serializing data based
on the syntax for JavaScript data structures.

dkjson is written in Lua without any dependencies, but
when LPeg is available dkjson uses it to speed up decoding.

<http://dkolf.de/src/dkjson-lua.fsl/>

Changes since version 2.2:

  *  Corrected the range of escaped characters.  Among other characters
     U+2029 was missing, which would cause trouble when parsed by a
     JavaScript interpreter [1].
  *  Added options to register the module table in a global variable.
     This is useful in environments where functions similar to require
     are not available.

This update is critical if you are using dkjson for "JSONP" [2] and
users might enter strings that contain U+2029.  When it is not escaped
this character would raise syntax errors on the client side where the
object is attempted to be parsed as JavaScript.

The release of version 1.2 is a pure bugfix release.

Best regards,

David Kolf

[1] <http://timelessrepo.com/json-isnt-a-javascript-subset>
[2] <http://en.wikipedia.org/wiki/JSONP>