/// <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 (!string.IsNullOrEmpty(Url)) { writer.WriteString("url", (string)Url !); } if (_Url != null) { writer.WritePropertyName("_url"); _Url.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(Version)) { writer.WriteString("version", (string)Version !); } if (_Version != null) { writer.WritePropertyName("_version"); _Version.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(Name)) { writer.WriteString("name", (string)Name !); } if (_Name != null) { writer.WritePropertyName("_name"); _Name.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(Title)) { writer.WriteString("title", (string)Title !); } if (_Title != null) { writer.WritePropertyName("_title"); _Title.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(ShortTitle)) { writer.WriteString("shortTitle", (string)ShortTitle !); } if (_ShortTitle != null) { writer.WritePropertyName("_shortTitle"); _ShortTitle.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(Subtitle)) { writer.WriteString("subtitle", (string)Subtitle !); } if (_Subtitle != null) { writer.WritePropertyName("_subtitle"); _Subtitle.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(Status)) { writer.WriteString("status", (string)Status !); } if (_Status != null) { writer.WritePropertyName("_status"); _Status.SerializeJson(writer, options); } if (Experimental != null) { writer.WriteBoolean("experimental", (bool)Experimental !); } if (SubjectCodeableConcept != null) { writer.WritePropertyName("subjectCodeableConcept"); SubjectCodeableConcept.SerializeJson(writer, options); } if (SubjectReference != null) { writer.WritePropertyName("subjectReference"); SubjectReference.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(Publisher)) { writer.WriteString("publisher", (string)Publisher !); } if (_Publisher != null) { writer.WritePropertyName("_publisher"); _Publisher.SerializeJson(writer, options); } if ((Contact != null) && (Contact.Count != 0)) { writer.WritePropertyName("contact"); writer.WriteStartArray(); foreach (ContactDetail valContact in Contact) { valContact.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 ((Comment != null) && (Comment.Count != 0)) { writer.WritePropertyName("comment"); writer.WriteStartArray(); foreach (string valComment in Comment) { writer.WriteStringValue(valComment); } writer.WriteEndArray(); } if ((_Comment != null) && (_Comment.Count != 0)) { writer.WritePropertyName("_comment"); writer.WriteStartArray(); foreach (Element val_Comment in _Comment) { val_Comment.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((UseContext != null) && (UseContext.Count != 0)) { writer.WritePropertyName("useContext"); writer.WriteStartArray(); foreach (UsageContext valUseContext in UseContext) { valUseContext.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((Jurisdiction != null) && (Jurisdiction.Count != 0)) { writer.WritePropertyName("jurisdiction"); writer.WriteStartArray(); foreach (CodeableConcept valJurisdiction in Jurisdiction) { valJurisdiction.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (!string.IsNullOrEmpty(Purpose)) { writer.WriteString("purpose", (string)Purpose !); } if (_Purpose != null) { writer.WritePropertyName("_purpose"); _Purpose.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(Usage)) { writer.WriteString("usage", (string)Usage !); } if (_Usage != null) { writer.WritePropertyName("_usage"); _Usage.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(Copyright)) { writer.WriteString("copyright", (string)Copyright !); } if (_Copyright != null) { writer.WritePropertyName("_copyright"); _Copyright.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(ApprovalDate)) { writer.WriteString("approvalDate", (string)ApprovalDate !); } if (_ApprovalDate != null) { writer.WritePropertyName("_approvalDate"); _ApprovalDate.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(LastReviewDate)) { writer.WriteString("lastReviewDate", (string)LastReviewDate !); } if (_LastReviewDate != null) { writer.WritePropertyName("_lastReviewDate"); _LastReviewDate.SerializeJson(writer, options); } if (EffectivePeriod != null) { writer.WritePropertyName("effectivePeriod"); EffectivePeriod.SerializeJson(writer, options); } if ((Topic != null) && (Topic.Count != 0)) { writer.WritePropertyName("topic"); writer.WriteStartArray(); foreach (CodeableConcept valTopic in Topic) { valTopic.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((Author != null) && (Author.Count != 0)) { writer.WritePropertyName("author"); writer.WriteStartArray(); foreach (ContactDetail valAuthor in Author) { valAuthor.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((Editor != null) && (Editor.Count != 0)) { writer.WritePropertyName("editor"); writer.WriteStartArray(); foreach (ContactDetail valEditor in Editor) { valEditor.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((Reviewer != null) && (Reviewer.Count != 0)) { writer.WritePropertyName("reviewer"); writer.WriteStartArray(); foreach (ContactDetail valReviewer in Reviewer) { valReviewer.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((Endorser != null) && (Endorser.Count != 0)) { writer.WritePropertyName("endorser"); writer.WriteStartArray(); foreach (ContactDetail valEndorser in Endorser) { valEndorser.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((RelatedArtifact != null) && (RelatedArtifact.Count != 0)) { writer.WritePropertyName("relatedArtifact"); writer.WriteStartArray(); foreach (RelatedArtifact valRelatedArtifact in RelatedArtifact) { valRelatedArtifact.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((Library != null) && (Library.Count != 0)) { writer.WritePropertyName("library"); writer.WriteStartArray(); foreach (string valLibrary in Library) { writer.WriteStringValue(valLibrary); } writer.WriteEndArray(); } if ((_Library != null) && (_Library.Count != 0)) { writer.WritePropertyName("_library"); writer.WriteStartArray(); foreach (Element val_Library in _Library) { val_Library.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (Population != null) { writer.WritePropertyName("population"); Population.SerializeJson(writer, options); } if (Exposure != null) { writer.WritePropertyName("exposure"); Exposure.SerializeJson(writer, options); } if (ExposureAlternative != null) { writer.WritePropertyName("exposureAlternative"); ExposureAlternative.SerializeJson(writer, options); } if (Outcome != null) { writer.WritePropertyName("outcome"); Outcome.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(); } ((Fhir.R4.Models.Element) this).SerializeJson(writer, options, false); if (!string.IsNullOrEmpty(Type)) { writer.WriteString("type", (string)Type !); } if (_Type != null) { writer.WritePropertyName("_type"); _Type.SerializeJson(writer, options); } if ((Profile != null) && (Profile.Count != 0)) { writer.WritePropertyName("profile"); writer.WriteStartArray(); foreach (string valProfile in Profile) { writer.WriteStringValue(valProfile); } writer.WriteEndArray(); } if ((_Profile != null) && (_Profile.Count != 0)) { writer.WritePropertyName("_profile"); writer.WriteStartArray(); foreach (Element val_Profile in _Profile) { val_Profile.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (SubjectCodeableConcept != null) { writer.WritePropertyName("subjectCodeableConcept"); SubjectCodeableConcept.SerializeJson(writer, options); } if (SubjectReference != null) { writer.WritePropertyName("subjectReference"); SubjectReference.SerializeJson(writer, options); } if ((MustSupport != null) && (MustSupport.Count != 0)) { writer.WritePropertyName("mustSupport"); writer.WriteStartArray(); foreach (string valMustSupport in MustSupport) { writer.WriteStringValue(valMustSupport); } writer.WriteEndArray(); } if ((_MustSupport != null) && (_MustSupport.Count != 0)) { writer.WritePropertyName("_mustSupport"); writer.WriteStartArray(); foreach (Element val_MustSupport in _MustSupport) { val_MustSupport.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((CodeFilter != null) && (CodeFilter.Count != 0)) { writer.WritePropertyName("codeFilter"); writer.WriteStartArray(); foreach (DataRequirementCodeFilter valCodeFilter in CodeFilter) { valCodeFilter.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((DateFilter != null) && (DateFilter.Count != 0)) { writer.WritePropertyName("dateFilter"); writer.WriteStartArray(); foreach (DataRequirementDateFilter valDateFilter in DateFilter) { valDateFilter.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (Limit != null) { writer.WriteNumber("limit", (uint)Limit !); } if ((Sort != null) && (Sort.Count != 0)) { writer.WritePropertyName("sort"); writer.WriteStartArray(); foreach (DataRequirementSort valSort in Sort) { valSort.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (includeStartObject) { writer.WriteEndObject(); } }