json handling for R objects