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.12rc2 ... 0.6 mostly works)
17 lfs (Tested with 1.4.1)
21 NOTE: LPeg 0.11 may not work - it crashed during my tests
23 Lua versions tested recently:
24 Lua 5.1.4 + strict + pl.strict
26 LuaJIT-2.0.0-beta10 + strict + pl.strict
29 All-but tests: MIT-style, See LICENSE for details
30 tests/*: Public Domain / MIT - whichever is least restrictive
32 Module/Function overview:
33 json.encode (callable module referencing json.encode.encode)
34 --encode ( value : ANY-valid )
36 Takes in a JSON-encodable value and returns the JSON-encoded text
39 array-like table (spec below)
43 'null' - represented by json.util.null
44 Table keys (string,number,boolean) are encoded as strings, others are erroneus
45 Table values are any valid input-type
46 Array-like tables are converted into JSON arrays...
47 Position 1 maps to JSON Array position 0
48 --isEncodable ( value : ANY )
49 Returns a boolean stating whether is is encodeable or not
50 NOTE: Tables/arrays are not deeply inspected
52 json.decode (callable module referencing json.decode.decode)
53 --decode (data : string, strict : optional boolean)
54 Takes in a string of JSON data and converts it into a Lua object
55 If 'strict' is set, then the strict JSON rule-set is used
58 --printValue (tab : ANY, name : string)
59 recursively prints out all object values - if duplicates found, reference printed
61 Reference value to represent 'null' in a well-defined way to
62 allow for null values to be inserted into an array/table
63 --merge (t : table, ... : tables)
64 Shallow-merges a sequence of tables onto table t by iterating over each using
68 parsing test suite from JSON_checker project of http://www.json.org/
69 No listed license for these files in their package.
72 Used sample Travis-CI build pieces from https://github.com/moteus/lua-travis-example
73 Copyright (c) 2014 Alexey Melnichuk