Closed SymbolixAU closed 5 years ago
df <- structure(list(id = c("1", "2"), val = list("a", 1:2)), class = "data.frame", row.names = 1:2) to_json( df ) # [{"id":"1","val":[["a"]]},{"id":"2","val":[[1,2]]}]
Maybe this should be
# [{"id":"1","val":["a"]},{"id":"2","val":[1,2]}]
but it needs to be consistent with the rules: https://symbolixau.github.io/jsonify/articles/jsonify.html#complex---lists
Because building this up suggests it's right as it is
to_json("a") # ["a"] to_json( list("a")) # '[["a"]] to_json( df[1, "val"] ) # '[["a"]]' to_json( df[, "val"] ) # '[["a"],[1,2]]' to_json( df ) # '[{"id":"1","val":[["a"]]},{"id":"2","val":[[1,2]]}]'
Maybe this should be
but it needs to be consistent with the rules: https://symbolixau.github.io/jsonify/articles/jsonify.html#complex---lists
Because building this up suggests it's right as it is