summaryrefslogtreecommitdiff
path: root/LICENSE (unfollow)
Commit message (Collapse)AuthorFilesLines
2011-05-10Add stack overflow fix to NEWSMark Pulford1-1/+2
2011-05-10run_test_group(): Change helper functions to localMark Pulford1-2/+2
2011-05-10Add runtime option for persistent encode bufferMark Pulford7-19/+75
2011-05-10Suspend the garbage collector during benchmarksMark Pulford1-1/+2
Suspending GC appears to make the benchmark results more consistent.
2011-05-10Fix memory leak when throwing stack overflow errorMark Pulford1-2/+11
json->tmp was not freed when throwing a Lua stack overflow exception.
2011-05-10Remove whitespace from generated JSON outputMark Pulford3-13/+14
Remove excess whitespace to reduce output size and increase encode performance. Suggested by: Zhang "agentzh" Yichun <agentzh@gmail.com>
2011-05-10Add extra encoding/nesting testsMark Pulford3-10/+45
- Use pcall() to call test config functions. - Test encoding with refuse_invalid_numbers() options. - Test encoding invalid types.
2011-05-10Add support for perl installs outside of /usr/binMark Pulford1-1/+2
Change "perl -w" to "use warnings" for compatibility with systems that put all #! args into argv[1].
2011-05-10Update version to 1.0.1Mark Pulford5-8/+10
2011-05-10Add build support for Mac OSXMark Pulford1-1/+11
2011-05-09Add TODO file1.0Mark Pulford2-1/+8
2011-05-09Tidy and reformat lua_cjson.c (minor)Mark Pulford1-12/+9
2011-05-08Add changelog (NEWS)Mark Pulford2-1/+3
2011-05-08Add documentation (README)Mark Pulford2-1/+212
2011-05-08Add test for excessive nesting during encodeMark Pulford2-6/+16
2011-05-08Add NaN/Inf encoding tests, rearrange test orderMark Pulford1-71/+74
2011-05-08Generate error when attempting to decode UTF-16/32Mark Pulford2-0/+12
2011-05-08Add UTF-16 surrogate pair decode supportMark Pulford5-11/+149
- Add tests for UTF-16 decoding and failures - Add getutf8.pl to assist with UTF-16 decode testing - Re-add test_decode_cycle() which was accidentally removed earlier - Rename bytestring.dat to octets-escaped.dat
2011-05-08Test octect encode/decode separatelyMark Pulford2-24/+9
2011-05-08Convert tests to automatically verify outputMark Pulford1-106/+107
2011-05-08Implement data driven test frameworkMark Pulford3-29/+158
- Add run_test(): Test a function and verify its output - Add run_test_group(): Execute a test batch - Add serialise_value(): Serialise a Lua value into the Lua syntax - Add file_save() helper function - Add NaN comparison support to compare_values()
2011-05-07Rework runtime config optionsMark Pulford1-56/+118
- Rename API for consistency: - sparse_ratio() -> encode_sparse_array() - max_depth() -> encode_max_depth() - invalid_numbers() -> refuse_invalid_numbers() - Adjust sparse array handling: - Add "safe" option to allow small sparse arrays regardless of the ratio. - Generate an error by default instead of converting an array into an object (POLA). - Update invalid number handling: - Allow decoding invalid numbers by default since many JSON implementations output NaN/Infinity. - Throw an error by default when attempting to encode NaN/Infinity since the RFC explicitly states it is not permitted. - Support specifying invalid number configuration separately for encode/decode.
2011-05-07Add test to compare objects after decode/encodeMark Pulford2-3/+40
2011-05-07Escape forward slash when encodingMark Pulford1-1/+1
Escaping forward slash can be useful when including JSON output in HTML (Eg, embedded in SCRIPT tags).
2011-05-05Fix strbuf_t leak on lua_close()Mark Pulford1-3/+20
- Add __gc metatable method to clean up json_config_t userdata.
2011-05-05Add tests directory to RPM %doc installMark Pulford1-1/+1
2011-05-04Add benchmark results (performance.txt)Mark Pulford2-1/+43
2011-05-04Document permission received to use examplesMark Pulford1-0/+2
Douglas Crockford <douglas@crockford.com> has given permission for these examples to be used. Message-ID: <4DC01FB7.8090001@crockford.com> Date: Tue, 03 May 2011 08:31:03 -0700 From: Douglas Crockford To: Mark Pulford Subject: Re: JSON examples
2011-05-03Add basic JSON tests and benchmarkMark Pulford11-0/+465
2011-05-03Generate parse error for invalid leading zerosMark Pulford1-8/+17
2011-05-03Preallocate temporary decode string bufferMark Pulford2-11/+20
The preallocated buffer removes the need for buffer length checks while processing strings and results in a 10 - 15% speedup.
2011-05-03Add strbuf_reset() to reset string lengthMark Pulford2-2/+8
Add strbuf_reset() to reset string length and hide the string implementation.
2011-05-03Escape all unprintable ASCII when encodingMark Pulford1-47/+94
Replace json_escape_char() with a static char2escape[] lookup table. Escape all unprintable ASCII (0-31, 127) and JSON special characters (double quote, backslash). Dynamic creation of the char2escape table has been left commented out due to an apparent performance hit. The performance loss may be due to memory/page alignment (unknown). Rename parsing lookup table from ch2escape to escape2char for consistency.
2011-05-03Implement minor performance improvementsMark Pulford1-42/+50
- Use strbuf_append_mem() for small static strings (~2% speedup). - Use &json_config_key for storing registry data. It's more unique and faster than a text string. - Use strbuf_append_char_unsafe() for string quotes (~4% speedup). - Use strbuf_append_number() instead of strbuf_append_fmt(). It is much simpler and avoids the potential for 2 expensive calls to vsnprintf(). - Make encoding buffer persistent across calls to avoid extra malloc/free (~4% speedup on example2.json). These performance improvements can be much more pronounced depending on the data. Eg, small strings, numbers, booleans, etc..
2011-05-03Add strbuf_append_number()Mark Pulford2-8/+27
The separate strbuf_append_number() function avoids a potential double call to the slow vsnprintf() function required by strbuf_append_fmt(). Also inline strbuf_append_mem() since it is very simple and will be used often.
2011-05-01Add build and package supportMark Pulford3-0/+83
- Add Makefile and RPM spec file - Add cjson.version variable
2011-05-01Update lua_cjson.c with minor fixesMark Pulford1-6/+3
- Fix typo and comment - Change "while" to "for" loop
2011-05-01Support optionally parsing Inf/NaN/Hex numbersMark Pulford1-31/+73
Change strict_numbers to control whether json.decode will parse an expanded set of numbers (Hex, Inf, NaN).
2011-05-01Add MIT license and update lua_cjson.c caveatsMark Pulford4-18/+102
2011-05-01Detect and throw error when parsing hexadecimalMark Pulford1-10/+20
2011-05-01Simplify generating parse error tokensMark Pulford1-28/+29
2011-05-01Throw error on Inf/NaN by default when encodingMark Pulford1-16/+49
Add runtime configuration for generating Inf/NaN encoding errors through cjson.strict_numbers().
2011-05-01Improve encoding exception error formatMark Pulford1-6/+7
Was: Cannot serialise <location>: <type> Now: Cannot serialise <type>: <reason>
2011-05-01Add detailed parse error reportingMark Pulford1-19/+45
- Always report the correct index of the token error. - Use value.string to report what was found instead of just T_ERROR. - Fix inverted unicode escape error detection.
2011-05-01Move static configuration into runtime userdataMark Pulford1-137/+230
Allow maximum nesting depth and sparse array ratio to be configured at runtime via the sparse_ratio() and max_depth() functions. Throw exceptions when encoding excessively nested structures.
2011-05-01Encode very sparse arrays as objectsMark Pulford1-1/+14
Detect and encode very sparse arrays as objects. This prevents something like: { [1000000] = "nullfest" } ..from generating a huge array.
2011-05-01Create "cjson" Lua module, support UCS-2 escapesMark Pulford2-99/+154
- Convert lua_json_init() into luaopen_cjson() to support dynamic .so loading. - Rename "json" to "cjson" to reduce conflicts with other JSON modules. - Remove unnecessary *_pcall_* API. Lua calls are fast enough, even through C. - Encode empty tables as objects - Add support for decoding all UCS-2 escape codes.
2011-04-26Update lua_json pcall API naming conventionMark Pulford1-5/+8
2011-04-26Move verify_arg_count() into lua_json.cMark Pulford1-4/+9
2011-04-25Grow decode stack, prealloc strings during encodeMark Pulford3-18/+34
- Check stack usage during decode to prevent crashing in excessively nested data structures. - Preallocate the required memory for json_append_string().