jeroen/jsonlite

fromJSON does not decode mongo coded dates.

Opened this issue · 0 comments

Consider this code:

dt <- Sys.time()
dtl <- fromJSON(toJSON(unbox(dt),POSIXt="mongo"),FALSE)

Returns a list with a name $date and a big integer.

This can be fixed with:

as.POSIXct(dtl$'$date'/1000,origin="1970-01-01")

But it would be nice if fromJSON could note the {"$date":1234} structure and convert it back to POSIX datetime.