A smarter JSON encoder/decoder for R