making data.to_json automatic