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, 5.3, LuaJIT 2.0, or LuaJIT 2.1
15 LPeg (Tested with 0.7, 0.8, 0.9, 0.10, 0.12rc2, 1.0)
17 lfs (Tested with 1.6.3)
21 NOTE: LPeg 0.11 may not work - it crashed during my initial tests,
22 it is not in the test matrix.
24 Lua versions tested recently:
32 All-but tests: MIT-style, See LICENSE for details
33 tests/*: Public Domain / MIT - whichever is least restrictive
35 Module/Function overview:
36 json.encode (callable module referencing json.encode.encode)
37 --encode ( value : ANY-valid )
39 Takes in a JSON-encodable value and returns the JSON-encoded text
42 array-like table (spec below)
46 'null' - represented by json.util.null
47 Table keys (string,number,boolean) are encoded as strings, others are erroneus
48 Table values are any valid input-type
49 Array-like tables are converted into JSON arrays...
50 Position 1 maps to JSON Array position 0
51 --isEncodable ( value : ANY )
52 Returns a boolean stating whether is is encodeable or not
53 NOTE: Tables/arrays are not deeply inspected
55 json.decode (callable module referencing json.decode.decode)
56 --decode (data : string, strict : optional boolean)
57 Takes in a string of JSON data and converts it into a Lua object
58 If 'strict' is set, then the strict JSON rule-set is used
61 --printValue (tab : ANY, name : string)
62 recursively prints out all object values - if duplicates found, reference printed
64 Reference value to represent 'null' in a well-defined way to
65 allow for null values to be inserted into an array/table
66 --merge (t : table, ... : tables)
67 Shallow-merges a sequence of tables onto table t by iterating over each using
71 parsing test suite from JSON_checker project of http://www.json.org/
72 No listed license for these files in their package.