Converts to JSON.
@override Map<String, dynamic> toJson() => { 'type': type, if (content != null) 'content': content!.map((e) => e.toJson()).toList(), };