2 JSON Parser/Constructor for Lua
4 Author: Thomas Harning Jr. <harningt@gmail.com>
7 http://repo.or.cz/luajson
10 http://github.com/harningt/luajson
14 Lua 5.1, 5.2, or LuaJIT 2.0
15 LPeg (Tested with 0.7, 0.8, 0.9, 0.10 ... 0.6 mostly works)
17 lfs (Tested with 1.4.1)
21 Lua versions tested recently:
24 LuaJIT-2.0.0-beta10 + strict
27 All-but tests: MIT-style, See LICENSE for details
28 tests/*: Public Domain / MIT - whichever is least restrictive
30 Module/Function overview:
31 json.encode (callable module referencing json.encode.encode)
32 --encode ( value : ANY-valid )
34 Takes in a JSON-encodable value and returns the JSON-encoded text
37 array-like table (spec below)
41 'null' - represented by json.util.null
42 Table keys (string,number,boolean) are encoded as strings, others are erroneus
43 Table values are any valid input-type
44 Array-like tables are converted into JSON arrays...
45 Position 1 maps to JSON Array position 0
46 --isEncodable ( value : ANY )
47 Returns a boolean stating whether is is encodeable or not
48 NOTE: Tables/arrays are not deeply inspected
50 json.decode (callable module referencing json.decode.decode)
51 --decode (data : string, strict : optional boolean)
52 Takes in a string of JSON data and converts it into a Lua object
53 If 'strict' is set, then the strict JSON rule-set is used
56 --printValue (tab : ANY, name : string)
57 recursively prints out all object values - if duplicates found, reference printed
59 Reference value to represent 'null' in a well-defined way to
60 allow for null values to be inserted into an array/table
63 parsing test suite from JSON_checker project of http://www.json.org/
64 No listed license for these files in their package.