/// <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 (MasterIdentifier != null) { writer.WritePropertyName("masterIdentifier"); MasterIdentifier.SerializeJson(writer, options); } 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 (!string.IsNullOrEmpty(DocStatus)) { writer.WriteString("docStatus", (string)DocStatus !); } if (_DocStatus != null) { writer.WritePropertyName("_docStatus"); _DocStatus.SerializeJson(writer, options); } if (Type != null) { writer.WritePropertyName("type"); Type.SerializeJson(writer, options); } if ((Category != null) && (Category.Count != 0)) { writer.WritePropertyName("category"); writer.WriteStartArray(); foreach (CodeableConcept valCategory in Category) { valCategory.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (Subject != null) { writer.WritePropertyName("subject"); Subject.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(Date)) { writer.WriteString("date", (string)Date !); } if (_Date != null) { writer.WritePropertyName("_date"); _Date.SerializeJson(writer, options); } if ((Author != null) && (Author.Count != 0)) { writer.WritePropertyName("author"); writer.WriteStartArray(); foreach (Reference valAuthor in Author) { valAuthor.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (Authenticator != null) { writer.WritePropertyName("authenticator"); Authenticator.SerializeJson(writer, options); } if (Custodian != null) { writer.WritePropertyName("custodian"); Custodian.SerializeJson(writer, options); } if ((RelatesTo != null) && (RelatesTo.Count != 0)) { writer.WritePropertyName("relatesTo"); writer.WriteStartArray(); foreach (DocumentReferenceRelatesTo valRelatesTo in RelatesTo) { valRelatesTo.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 ((SecurityLabel != null) && (SecurityLabel.Count != 0)) { writer.WritePropertyName("securityLabel"); writer.WriteStartArray(); foreach (CodeableConcept valSecurityLabel in SecurityLabel) { valSecurityLabel.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((Content != null) && (Content.Count != 0)) { writer.WritePropertyName("content"); writer.WriteStartArray(); foreach (DocumentReferenceContent valContent in Content) { valContent.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (Context != null) { writer.WritePropertyName("context"); Context.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 (MasterIdentifier != null) { writer.WritePropertyName("masterIdentifier"); MasterIdentifier.SerializeJson(writer, options); } 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 (Subject != null) { writer.WritePropertyName("subject"); Subject.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(Created)) { writer.WriteString("created", (string)Created !); } if (_Created != null) { writer.WritePropertyName("_created"); _Created.SerializeJson(writer, options); } if ((Author != null) && (Author.Count != 0)) { writer.WritePropertyName("author"); writer.WriteStartArray(); foreach (Reference valAuthor in Author) { valAuthor.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((Recipient != null) && (Recipient.Count != 0)) { writer.WritePropertyName("recipient"); writer.WriteStartArray(); foreach (Reference valRecipient in Recipient) { valRecipient.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (!string.IsNullOrEmpty(Source)) { writer.WriteString("source", (string)Source !); } if (_Source != null) { writer.WritePropertyName("_source"); _Source.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(Description)) { writer.WriteString("description", (string)Description !); } if (_Description != null) { writer.WritePropertyName("_description"); _Description.SerializeJson(writer, options); } if ((Content != null) && (Content.Count != 0)) { writer.WritePropertyName("content"); writer.WriteStartArray(); foreach (Reference valContent in Content) { valContent.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((Related != null) && (Related.Count != 0)) { writer.WritePropertyName("related"); writer.WriteStartArray(); foreach (DocumentManifestRelated valRelated in Related) { valRelated.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (includeStartObject) { writer.WriteEndObject(); } }