Hi,
I noticed the following behaviour with toJSON:
cat(toJSON(data.frame(logical(0)), byrow=TRUE), '\n')
[
[
null
],
[]
]
When I would instead expect [] (?)
I believe the problem comes from this line
if(byrow) {
tmp = lapply(1:nrow(x), function(i) { row = as.list(x[i, ])
if(colNames)
row
else
unname(row)
})
where 1:nrow(x) should be replaced by seq_len(nrow(x)) (because 1:0 is actually the vector c(1,0)).