2 JSON Parser/Constructor for Lua
5 Thomas Harning Jr. <harningt@gmail.com>
8 http://repo.or.cz/luajson
11 http://github.com/harningt/luajson
15 Lua 5.1, 5.2, 5.3, LuaJIT 2.0, or LuaJIT 2.1
16 LPeg (Tested with 0.7, 0.8, 0.9, 0.10, 0.12rc2, 1.0)
18 lfs (Tested with 1.6.3)
23 LPeg 0.11 may not work - it crashed during my initial tests,
24 it is not in the test matrix.
26 ### Lua versions tested recently:
34 All-but tests: MIT-style, See LICENSE for details
35 tests/*: Public Domain / MIT - whichever is least restrictive
37 ### Module/Function overview:
38 ### json.encode (callable module referencing json.encode.encode)
39 ___encode ( value : ANY-valid )___
41 Takes in a JSON-encodable value and returns the JSON-encoded text
44 * array-like table (spec below)
48 * 'null' - represented by json.util.null
50 Table keys (string,number,boolean) are encoded as strings, others are erroneus
51 Table values are any valid input-type
52 Array-like tables are converted into JSON arrays...
53 Position 1 maps to JSON Array position 0
55 ___isEncodable ( value : ANY )___
57 Returns a boolean stating whether is is encodeable or not
58 NOTE: Tables/arrays are not deeply inspected
60 ### json.decode (callable module referencing json.decode.decode)
61 ___decode (data : string, strict : optional boolean)___
63 Takes in a string of JSON data and converts it into a Lua object
64 If 'strict' is set, then the strict JSON rule-set is used
67 ___printValue (tab : ANY, name : string)___
69 recursively prints out all object values - if duplicates found, reference printed
73 Reference value to represent 'null' in a well-defined way to
74 allow for null values to be inserted into an array/table
76 ___merge (t : table, ... : tables)___
78 Shallow-merges a sequence of tables onto table t by iterating over each using
82 parsing test suite from JSON_checker project of http://www.json.org/
83 No listed license for these files in their package.