clean up toJson() method