encodes ruby objects as json