I have properly formatted JSON fetched through a standard API.
API Basically returns an array of JSON objects each time I fetch data.
LIke this:
[
{},
{},
{}
]
I have used JSON editor to check structure of JSON data and that looks perfect. I need to convert it to CSV so tried this:
freshDeskRaw <- fromJSON(freshDeskTickets)
tmp <- lapply(freshDeskRaw , function(u)
lapply(u, function(x) if(is.null(x)) NA else x)
)
tmp <- lapply( tmp, as.data.frame)
tmp <- do.call( rbind, tmp )
At
tmp <- lapply( tmp, as.data.frame)
, I get an error:
tmp <- lapply( tmp, as.data.frame) Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE, : arguments imply differing number of rows: 0, 1
how do I fix this? what looks wrong? I have tried to use
as.data.frame(tmp)
as well but still get the same error.