Q:

fromJSON + ldply: fix error incorrect number of subscripts on matrix

I have a JSON that has this structure:
{\"A\": [[\"x\", 0.2], [\"y\", 0.3], [\"z\", 0.3]], \"B\": [[\"x\", 0.2], [\"y\", 0.3]]} 

I am trying to do this:
library(jsonlite)
library(plyr)
my_data <- fromJSON(my_json_file, flatten = TRUE)
my_data <- ldply(my_data, rbind)

but I get this error:
Error in output[rng, lcols[[i]]] <- matrices[[i]] : 
  incorrect number of subscripts on matrix

I tried to do do.call(rbind, my_json_file) and by doing that some information is missing because ldply should return
V1 | V2 | V3
A  | x  | 0.2
A  | y  | 0.3
A  | z  | 0.3
B  | x  | 0.2
B  | y  | 0.3

and do.call returns
V2 | V3
x  | 0.2
y  | 0.3
z  | 0.3
x  | 0.2
y  | 0.3

Is there a way to force ldply or to obtain the same result with do.call?

A:

as @SymbolixAU started the solution when ldply doesn't work is
my_data <- do.call(rbind, lapply(fromJSON(my_json), data.frame))
my_data$id <- colnames(my_data)

