Skip to content

Commit

Permalink
Changed empty table to be treated as array when encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
rxi committed Sep 6, 2015
1 parent 19b61e0 commit 89b0e90
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion json.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ local function encode_table(val, stack)

stack[val] = true

if val[1] ~= nil then
if val[1] ~= nil or next(val) == nil then
-- Treat as array -- check keys are valid and it is not sparse
local n = 0
for k in pairs(val) do
Expand Down

0 comments on commit 89b0e90

Please sign in to comment.