/// <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.BackboneElement) this).SerializeJson(writer, options, false);

            if ((SupportingInfoSequence != null) && (SupportingInfoSequence.Count != 0))
            {
                writer.WritePropertyName("supportingInfoSequence");
                writer.WriteStartArray();

                foreach (uint valSupportingInfoSequence in SupportingInfoSequence)
                {
                    writer.WriteNumberValue(valSupportingInfoSequence);
                }

                writer.WriteEndArray();
            }

            if (Category != null)
            {
                writer.WritePropertyName("category");
                Category.SerializeJson(writer, options);
            }

            if (ProductOrService != null)
            {
                writer.WritePropertyName("productOrService");
                ProductOrService.SerializeJson(writer, options);
            }

            if ((Modifier != null) && (Modifier.Count != 0))
            {
                writer.WritePropertyName("modifier");
                writer.WriteStartArray();

                foreach (CodeableConcept valModifier in Modifier)
                {
                    valModifier.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (Provider != null)
            {
                writer.WritePropertyName("provider");
                Provider.SerializeJson(writer, options);
            }

            if (Quantity != null)
            {
                writer.WritePropertyName("quantity");
                Quantity.SerializeJson(writer, options);
            }

            if (UnitPrice != null)
            {
                writer.WritePropertyName("unitPrice");
                UnitPrice.SerializeJson(writer, options);
            }

            if (Facility != null)
            {
                writer.WritePropertyName("facility");
                Facility.SerializeJson(writer, options);
            }

            if ((Diagnosis != null) && (Diagnosis.Count != 0))
            {
                writer.WritePropertyName("diagnosis");
                writer.WriteStartArray();

                foreach (CoverageEligibilityRequestItemDiagnosis valDiagnosis in Diagnosis)
                {
                    valDiagnosis.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((Detail != null) && (Detail.Count != 0))
            {
                writer.WritePropertyName("detail");
                writer.WriteStartArray();

                foreach (Reference valDetail in Detail)
                {
                    valDetail.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
Пример #2
0
        /// <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.BackboneElement) this).SerializeJson(writer, options, false);

            if (Category != null)
            {
                writer.WritePropertyName("category");
                Category.SerializeJson(writer, options);
            }

            if (ProductOrService != null)
            {
                writer.WritePropertyName("productOrService");
                ProductOrService.SerializeJson(writer, options);
            }

            if ((Modifier != null) && (Modifier.Count != 0))
            {
                writer.WritePropertyName("modifier");
                writer.WriteStartArray();

                foreach (CodeableConcept valModifier in Modifier)
                {
                    valModifier.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (Provider != null)
            {
                writer.WritePropertyName("provider");
                Provider.SerializeJson(writer, options);
            }

            if (Excluded != null)
            {
                writer.WriteBoolean("excluded", (bool)Excluded !);
            }

            if (!string.IsNullOrEmpty(Name))
            {
                writer.WriteString("name", (string)Name !);
            }

            if (_Name != null)
            {
                writer.WritePropertyName("_name");
                _Name.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(Description))
            {
                writer.WriteString("description", (string)Description !);
            }

            if (_Description != null)
            {
                writer.WritePropertyName("_description");
                _Description.SerializeJson(writer, options);
            }

            if (Network != null)
            {
                writer.WritePropertyName("network");
                Network.SerializeJson(writer, options);
            }

            if (Unit != null)
            {
                writer.WritePropertyName("unit");
                Unit.SerializeJson(writer, options);
            }

            if (Term != null)
            {
                writer.WritePropertyName("term");
                Term.SerializeJson(writer, options);
            }

            if ((Benefit != null) && (Benefit.Count != 0))
            {
                writer.WritePropertyName("benefit");
                writer.WriteStartArray();

                foreach (CoverageEligibilityResponseInsuranceItemBenefit valBenefit in Benefit)
                {
                    valBenefit.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (AuthorizationRequired != null)
            {
                writer.WriteBoolean("authorizationRequired", (bool)AuthorizationRequired !);
            }

            if ((AuthorizationSupporting != null) && (AuthorizationSupporting.Count != 0))
            {
                writer.WritePropertyName("authorizationSupporting");
                writer.WriteStartArray();

                foreach (CodeableConcept valAuthorizationSupporting in AuthorizationSupporting)
                {
                    valAuthorizationSupporting.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (!string.IsNullOrEmpty(AuthorizationUrl))
            {
                writer.WriteString("authorizationUrl", (string)AuthorizationUrl !);
            }

            if (_AuthorizationUrl != null)
            {
                writer.WritePropertyName("_authorizationUrl");
                _AuthorizationUrl.SerializeJson(writer, options);
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }