craigmj/json4lua — pull request #2 by aoxu (2013-08-09 07:40:40+00:00)
Title: fix decoding nested empty json array error

Empty arrays are currently not handled properly in the parser. I added a test and fix for json.lua.
Please have a look.

Thanks,
Philipp

Ps. json.decode("[]") results in the following error:

lua: ./json.lua:366: Unexpected character at Line 1 character 2: ] (93) when reading array ({ or [ or ' or " or number or boolean or null expected)
Context:
[]
^
stack traceback:
[C]: in function 'error'
./json.lua:366: in function 'next_token'
./json.lua:473: in function <./json.lua:468>
(tail call): ?
(tail call): ?
./json.lua:513: in function 'decode'
tests.lua:175: in function 'testJSON4Lua'
tests.lua:222: in main chunk
[C]: ?