/// <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 (ClinicalStatus != null) { writer.WritePropertyName("clinicalStatus"); ClinicalStatus.SerializeJson(writer, options); } if (VerificationStatus != null) { writer.WritePropertyName("verificationStatus"); VerificationStatus.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 (Severity != null) { writer.WritePropertyName("severity"); Severity.SerializeJson(writer, options); } if (Code != null) { writer.WritePropertyName("code"); Code.SerializeJson(writer, options); } if ((BodySite != null) && (BodySite.Count != 0)) { writer.WritePropertyName("bodySite"); writer.WriteStartArray(); foreach (CodeableConcept valBodySite in BodySite) { valBodySite.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (Subject != null) { writer.WritePropertyName("subject"); Subject.SerializeJson(writer, options); } if (Encounter != null) { writer.WritePropertyName("encounter"); Encounter.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(OnsetDateTime)) { writer.WriteString("onsetDateTime", (string)OnsetDateTime !); } if (_OnsetDateTime != null) { writer.WritePropertyName("_onsetDateTime"); _OnsetDateTime.SerializeJson(writer, options); } if (OnsetAge != null) { writer.WritePropertyName("onsetAge"); OnsetAge.SerializeJson(writer, options); } if (OnsetPeriod != null) { writer.WritePropertyName("onsetPeriod"); OnsetPeriod.SerializeJson(writer, options); } if (OnsetRange != null) { writer.WritePropertyName("onsetRange"); OnsetRange.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(OnsetString)) { writer.WriteString("onsetString", (string)OnsetString !); } if (_OnsetString != null) { writer.WritePropertyName("_onsetString"); _OnsetString.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(AbatementDateTime)) { writer.WriteString("abatementDateTime", (string)AbatementDateTime !); } if (_AbatementDateTime != null) { writer.WritePropertyName("_abatementDateTime"); _AbatementDateTime.SerializeJson(writer, options); } if (AbatementAge != null) { writer.WritePropertyName("abatementAge"); AbatementAge.SerializeJson(writer, options); } if (AbatementPeriod != null) { writer.WritePropertyName("abatementPeriod"); AbatementPeriod.SerializeJson(writer, options); } if (AbatementRange != null) { writer.WritePropertyName("abatementRange"); AbatementRange.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(AbatementString)) { writer.WriteString("abatementString", (string)AbatementString !); } if (_AbatementString != null) { writer.WritePropertyName("_abatementString"); _AbatementString.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(RecordedDate)) { writer.WriteString("recordedDate", (string)RecordedDate !); } if (_RecordedDate != null) { writer.WritePropertyName("_recordedDate"); _RecordedDate.SerializeJson(writer, options); } if (Recorder != null) { writer.WritePropertyName("recorder"); Recorder.SerializeJson(writer, options); } if (Asserter != null) { writer.WritePropertyName("asserter"); Asserter.SerializeJson(writer, options); } if ((Stage != null) && (Stage.Count != 0)) { writer.WritePropertyName("stage"); writer.WriteStartArray(); foreach (ConditionStage valStage in Stage) { valStage.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((Evidence != null) && (Evidence.Count != 0)) { writer.WritePropertyName("evidence"); writer.WriteStartArray(); foreach (ConditionEvidence valEvidence in Evidence) { valEvidence.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((Note != null) && (Note.Count != 0)) { writer.WritePropertyName("note"); writer.WriteStartArray(); foreach (Annotation valNote in Note) { valNote.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) { writer.WritePropertyName("identifier"); Identifier.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(Actuality)) { writer.WriteString("actuality", (string)Actuality !); } if (_Actuality != null) { writer.WritePropertyName("_actuality"); _Actuality.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 (Event != null) { writer.WritePropertyName("event"); Event.SerializeJson(writer, options); } if (Subject != null) { writer.WritePropertyName("subject"); Subject.SerializeJson(writer, options); } if (Encounter != null) { writer.WritePropertyName("encounter"); Encounter.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(Date)) { writer.WriteString("date", (string)Date !); } if (_Date != null) { writer.WritePropertyName("_date"); _Date.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(Detected)) { writer.WriteString("detected", (string)Detected !); } if (_Detected != null) { writer.WritePropertyName("_detected"); _Detected.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(RecordedDate)) { writer.WriteString("recordedDate", (string)RecordedDate !); } if (_RecordedDate != null) { writer.WritePropertyName("_recordedDate"); _RecordedDate.SerializeJson(writer, options); } if ((ResultingCondition != null) && (ResultingCondition.Count != 0)) { writer.WritePropertyName("resultingCondition"); writer.WriteStartArray(); foreach (Reference valResultingCondition in ResultingCondition) { valResultingCondition.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (Location != null) { writer.WritePropertyName("location"); Location.SerializeJson(writer, options); } if (Seriousness != null) { writer.WritePropertyName("seriousness"); Seriousness.SerializeJson(writer, options); } if (Severity != null) { writer.WritePropertyName("severity"); Severity.SerializeJson(writer, options); } if (Outcome != null) { writer.WritePropertyName("outcome"); Outcome.SerializeJson(writer, options); } if (Recorder != null) { writer.WritePropertyName("recorder"); Recorder.SerializeJson(writer, options); } if ((Contributor != null) && (Contributor.Count != 0)) { writer.WritePropertyName("contributor"); writer.WriteStartArray(); foreach (Reference valContributor in Contributor) { valContributor.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((SuspectEntity != null) && (SuspectEntity.Count != 0)) { writer.WritePropertyName("suspectEntity"); writer.WriteStartArray(); foreach (AdverseEventSuspectEntity valSuspectEntity in SuspectEntity) { valSuspectEntity.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((SubjectMedicalHistory != null) && (SubjectMedicalHistory.Count != 0)) { writer.WritePropertyName("subjectMedicalHistory"); writer.WriteStartArray(); foreach (Reference valSubjectMedicalHistory in SubjectMedicalHistory) { valSubjectMedicalHistory.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((ReferenceDocument != null) && (ReferenceDocument.Count != 0)) { writer.WritePropertyName("referenceDocument"); writer.WriteStartArray(); foreach (Reference valReferenceDocument in ReferenceDocument) { valReferenceDocument.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((Study != null) && (Study.Count != 0)) { writer.WritePropertyName("study"); writer.WriteStartArray(); foreach (Reference valStudy in Study) { valStudy.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (includeStartObject) { writer.WriteEndObject(); } }