Convert the Content to json format.
Map<String, Object?> toJson() => { 'role': ?role, 'parts': parts.map((p) => p.toJson()).toList(), };