use toJson and fromJson