Converts to JSON.
@override Map<String, dynamic> toJson() => { 'type': type, 'template': template.map((m) => m.toJson()).toList(), };