Adding new method `toJSON` to export model.