duncantl/RJSONIO — pull request #2 by jcheng5 (2013-06-30 05:03:17+00:00)
Title: Data frame vars should be treated as containers

The current behavior for RJSONIO:

```
> cat(RJSONIO::toJSON(head(cars, 3)))
{
"speed": [ 4, 4, 7 ],
"dist": [ 2, 10, 4 ]
}
> cat(RJSONIO::toJSON(head(cars, 1)))
{
"speed": 4,
"dist": 2
}
```

When nrow(x) == 1, data frame variables are transmitted as scalars. This behavior makes sense for lists, but not for data frames, which are inherently tabular. The Shiny framework makes heavy use of RJSONIO and this behavior has surprised users several times.

With this patch:

```
> cat(RJSONIO::toJSON(head(cars, 1)))
{
"speed": [ 4 ],
"dist": [ 2 ]
}
```