Conversion between JSON and model