Commit Graph

34 Commits (0e6634a54ed3d1124382a7f81ef9c716860c76a3)

Author SHA1 Message Date
Milind Gupta 0e6634a54e Improved indentation by using tab. Added module variable SPARSELIMIT to control the length threshold of sparse arrays. Some bug fixes and improvements as suggested by @appgurueu 2023-11-27 20:38:05 -08:00
Milind Gupta 75127d2c7d Added check to prevent sparse arrays > 100 getting through 2023-11-24 21:41:40 -08:00
aryajur f521e4ac03 nLen initialization fixed 2020-08-22 22:25:28 -07:00
aryajur 32a59c89b0 Updated code to allow array specifications using table.pack function. The array detection code now allows for the array to have a key n with a number value to detect the array length. 2020-08-18 21:42:49 -07:00
aryajur ad6ac0fd8e Improved table encoding code to handle sparse arrays. Floating point numbers are encoding improved. 2020-07-19 15:26:25 -07:00
rxi 11077824d7 Updated copyright year: 2019 => 2020 2020-04-05 12:06:41 +01:00
rxi 2e76cfb067 Fixed bug in `parse_string`'s escape sequence handling
Fixes #22
2020-04-05 11:56:28 +01:00
rxi d1e3b0f5d0 Version 0.1.2 2019-06-21 22:44:42 +01:00
rxi 69b714ad2b Updated copyright year (2018 -> 2019) 2019-04-09 20:20:50 +01:00
niki d3f417d4d4 fix array detection when using overloaded indexing 2019-01-11 19:22:04 +01:00
rxi bee7ee3431 Version 0.1.1 2018-04-08 16:17:25 +01:00
rxi eb6e343c53 Added checking and tests for trailing garbage when decoding 2018-03-10 14:28:50 +00:00
rxi 19cc024df6 Updated copyright year (2015 -> 2018), moved full license to json.lua 2018-03-10 14:16:05 +00:00
rxi cc9833592e Version 0.1.0 2015-09-15 22:34:55 +01:00
rxi bf3ebf6679 Added argument type-checking to json.decode() 2015-09-06 14:07:28 +01:00
rxi 89b0e905ef Changed empty table to be treated as array when encoding 2015-09-06 10:32:25 +01:00
rxi 19b61e0628 Improved error message when encoding mixed/bad key types 2015-09-05 19:56:53 +01:00
rxi 4fb28bbeee Fixed decoding of escaped '/', added test 2015-08-31 18:43:08 +01:00
rxi 9fbfcde195 Improved error messages when encoding invalid table 2015-08-30 19:17:58 +01:00
rxi 70556ccea5 Added checking for sparseness and mixed key types when encoding array 2015-08-30 19:08:50 +01:00
rxi 3845cef229 Renamed 'keyword' -> 'literal' 2015-08-20 18:54:00 +01:00
rxi 83164fb45c Removed unused `chr` argument from internal parse funcs 2015-08-19 21:15:32 +01:00
rxi 425c8b3e88 Replaced use of string.sub() + .byte() in parse_string with just .byte()
Provides a noticeable speed improvement on both Lua5.2 and LuaJIT 2.0.2
2015-08-19 21:00:40 +01:00
rxi 6fdbd28ed9 Replaced new-line-in-string check with control-char check; tests 2015-08-19 20:00:11 +01:00
rxi 7f823abd2e Fixed parse_string() to handle "\\" correctly, added tests 2015-08-19 19:28:10 +01:00
rxi 9beca8a5bd Changed encode_number() number->string conversion method
Using Lua5.3, tonumber() will represent the float `1` as "1.0" instead
of "1". Using string.format("%14g, x) `1` is converted to "1" regardless
of whether it's an int or float. All other conversions seem to be
uneffected.
2015-08-15 11:52:07 +01:00
rxi 3cfffd299e Fixed codepoint_to_utf8()'s string.char usage for Lua5.3
Lua5.3 requires that string.char's arguments are integers (<=5.2 and JIT
do not)
2015-08-15 10:56:01 +01:00
rxi b51b7a53f7 Minor formatting change to parse() func 2015-08-15 10:41:39 +01:00
rxi 89a5a96194 Removed support for numbers starting with "." 2015-08-13 18:33:18 +01:00
rxi 8d14272359 Fixed parse_object() to disallow non-string keys 2015-08-13 18:31:21 +01:00
rxi 10811fbad7 Added support for decoing surrogate pairs 2015-08-12 19:37:03 +01:00
rxi f36b2f34b7 Removed use of loadstring() in parse_string()
Significant performance boost
2015-08-12 18:23:30 +01:00
rxi 157fa12fae Fixed parse_keyword() from making null -> false 2015-08-11 21:15:49 +01:00
rxi 8b9c820218 Initial commit 2015-08-11 21:08:33 +01:00