/// <summary> /// Serialize to a JSON object /// </summary> public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true) { if (includeStartObject) { writer.WriteStartObject(); } if (!string.IsNullOrEmpty(ResourceType)) { writer.WriteString("resourceType", (string)ResourceType !); } ((fhirCsR4.Models.DomainResource) this).SerializeJson(writer, options, false); if ((Identifier != null) && (Identifier.Count != 0)) { writer.WritePropertyName("identifier"); writer.WriteStartArray(); foreach (Identifier valIdentifier in Identifier) { valIdentifier.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (Active != null) { writer.WriteBoolean("active", (bool)Active !); } if ((Type != null) && (Type.Count != 0)) { writer.WritePropertyName("type"); writer.WriteStartArray(); foreach (CodeableConcept valType in Type) { valType.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (!string.IsNullOrEmpty(Name)) { writer.WriteString("name", (string)Name !); } if (_Name != null) { writer.WritePropertyName("_name"); _Name.SerializeJson(writer, options); } if ((Alias != null) && (Alias.Count != 0)) { writer.WritePropertyName("alias"); writer.WriteStartArray(); foreach (string valAlias in Alias) { writer.WriteStringValue(valAlias); } writer.WriteEndArray(); } if ((_Alias != null) && (_Alias.Count != 0)) { writer.WritePropertyName("_alias"); writer.WriteStartArray(); foreach (Element val_Alias in _Alias) { val_Alias.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((Telecom != null) && (Telecom.Count != 0)) { writer.WritePropertyName("telecom"); writer.WriteStartArray(); foreach (ContactPoint valTelecom in Telecom) { valTelecom.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((Address != null) && (Address.Count != 0)) { writer.WritePropertyName("address"); writer.WriteStartArray(); foreach (Address valAddress in Address) { valAddress.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (PartOf != null) { writer.WritePropertyName("partOf"); PartOf.SerializeJson(writer, options); } if ((Contact != null) && (Contact.Count != 0)) { writer.WritePropertyName("contact"); writer.WriteStartArray(); foreach (OrganizationContact valContact in Contact) { valContact.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((Endpoint != null) && (Endpoint.Count != 0)) { writer.WritePropertyName("endpoint"); writer.WriteStartArray(); foreach (Reference valEndpoint in Endpoint) { valEndpoint.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (includeStartObject) { writer.WriteEndObject(); } }
/// <summary> /// Serialize to a JSON object /// </summary> public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true) { if (includeStartObject) { writer.WriteStartObject(); } if (!string.IsNullOrEmpty(ResourceType)) { writer.WriteString("resourceType", (string)ResourceType !); } ((Fhir.R4.Models.DomainResource) this).SerializeJson(writer, options, false); if ((Identifier != null) && (Identifier.Count != 0)) { writer.WritePropertyName("identifier"); writer.WriteStartArray(); foreach (Identifier valIdentifier in Identifier) { valIdentifier.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (!string.IsNullOrEmpty(Status)) { writer.WriteString("status", (string)Status !); } if (_Status != null) { writer.WritePropertyName("_status"); _Status.SerializeJson(writer, options); } if (Type != null) { writer.WritePropertyName("type"); Type.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(Name)) { writer.WriteString("name", (string)Name !); } if (_Name != null) { writer.WritePropertyName("_name"); _Name.SerializeJson(writer, options); } if ((Subject != null) && (Subject.Count != 0)) { writer.WritePropertyName("subject"); writer.WriteStartArray(); foreach (Reference valSubject in Subject) { valSubject.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (ServicePeriod != null) { writer.WritePropertyName("servicePeriod"); ServicePeriod.SerializeJson(writer, options); } if ((Coverage != null) && (Coverage.Count != 0)) { writer.WritePropertyName("coverage"); writer.WriteStartArray(); foreach (AccountCoverage valCoverage in Coverage) { valCoverage.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (Owner != null) { writer.WritePropertyName("owner"); Owner.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(Description)) { writer.WriteString("description", (string)Description !); } if (_Description != null) { writer.WritePropertyName("_description"); _Description.SerializeJson(writer, options); } if ((Guarantor != null) && (Guarantor.Count != 0)) { writer.WritePropertyName("guarantor"); writer.WriteStartArray(); foreach (AccountGuarantor valGuarantor in Guarantor) { valGuarantor.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (PartOf != null) { writer.WritePropertyName("partOf"); PartOf.SerializeJson(writer, options); } if (includeStartObject) { writer.WriteEndObject(); } }
/// <summary> /// Serialize to a JSON object /// </summary> public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true) { if (includeStartObject) { writer.WriteStartObject(); } if (!string.IsNullOrEmpty(ResourceType)) { writer.WriteString("resourceType", (string)ResourceType !); } ((Fhir.R4.Models.DomainResource) this).SerializeJson(writer, options, false); if ((Identifier != null) && (Identifier.Count != 0)) { writer.WritePropertyName("identifier"); writer.WriteStartArray(); foreach (Identifier valIdentifier in Identifier) { valIdentifier.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (!string.IsNullOrEmpty(Status)) { writer.WriteString("status", (string)Status !); } if (_Status != null) { writer.WritePropertyName("_status"); _Status.SerializeJson(writer, options); } if (OperationalStatus != null) { writer.WritePropertyName("operationalStatus"); OperationalStatus.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(Name)) { writer.WriteString("name", (string)Name !); } if (_Name != null) { writer.WritePropertyName("_name"); _Name.SerializeJson(writer, options); } if ((Alias != null) && (Alias.Count != 0)) { writer.WritePropertyName("alias"); writer.WriteStartArray(); foreach (string valAlias in Alias) { writer.WriteStringValue(valAlias); } writer.WriteEndArray(); } if ((_Alias != null) && (_Alias.Count != 0)) { writer.WritePropertyName("_alias"); writer.WriteStartArray(); foreach (Element val_Alias in _Alias) { val_Alias.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (!string.IsNullOrEmpty(Description)) { writer.WriteString("description", (string)Description !); } if (_Description != null) { writer.WritePropertyName("_description"); _Description.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(Mode)) { writer.WriteString("mode", (string)Mode !); } if (_Mode != null) { writer.WritePropertyName("_mode"); _Mode.SerializeJson(writer, options); } if ((Type != null) && (Type.Count != 0)) { writer.WritePropertyName("type"); writer.WriteStartArray(); foreach (CodeableConcept valType in Type) { valType.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((Telecom != null) && (Telecom.Count != 0)) { writer.WritePropertyName("telecom"); writer.WriteStartArray(); foreach (ContactPoint valTelecom in Telecom) { valTelecom.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (Address != null) { writer.WritePropertyName("address"); Address.SerializeJson(writer, options); } if (PhysicalType != null) { writer.WritePropertyName("physicalType"); PhysicalType.SerializeJson(writer, options); } if (Position != null) { writer.WritePropertyName("position"); Position.SerializeJson(writer, options); } if (ManagingOrganization != null) { writer.WritePropertyName("managingOrganization"); ManagingOrganization.SerializeJson(writer, options); } if (PartOf != null) { writer.WritePropertyName("partOf"); PartOf.SerializeJson(writer, options); } if ((HoursOfOperation != null) && (HoursOfOperation.Count != 0)) { writer.WritePropertyName("hoursOfOperation"); writer.WriteStartArray(); foreach (LocationHoursOfOperation valHoursOfOperation in HoursOfOperation) { valHoursOfOperation.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (!string.IsNullOrEmpty(AvailabilityExceptions)) { writer.WriteString("availabilityExceptions", (string)AvailabilityExceptions !); } if (_AvailabilityExceptions != null) { writer.WritePropertyName("_availabilityExceptions"); _AvailabilityExceptions.SerializeJson(writer, options); } if ((Endpoint != null) && (Endpoint.Count != 0)) { writer.WritePropertyName("endpoint"); writer.WriteStartArray(); foreach (Reference valEndpoint in Endpoint) { valEndpoint.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (includeStartObject) { writer.WriteEndObject(); } }