jsonlite icon indicating copy to clipboard operation
jsonlite copied to clipboard

"auto_unbox = TRUE" does not unbox vector corresponding to one data.frame

Open apsalverda opened this issue 3 years ago • 0 comments

toJSON(list(x = 1, y = data.frame(a = 2, b = 3)), pretty = TRUE, auto_unbox = TRUE)
{
  "x": 1,
  "y": [
    {
      "a": 2,
      "b": 3
    }
  ]
}

Note that unbox does not work even though y is a vector containing 1 object. Desired output is:

{
  "x": 1,
  "y": {
    "a": 2,
    "b": 3
    }
}

apsalverda avatar Jul 21 '22 16:07 apsalverda