Пример #1
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 (AmountQuantity != null)
            {
                writer.WritePropertyName("amountQuantity");
                AmountQuantity.SerializeJson(writer, options);
            }

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

            if (!string.IsNullOrEmpty(AmountString))
            {
                writer.WriteString("amountString", (string)AmountString !);
            }

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

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

            if (!string.IsNullOrEmpty(AmountText))
            {
                writer.WriteString("amountText", (string)AmountText !);
            }

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

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

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

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

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

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

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

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

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

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

            if (!string.IsNullOrEmpty(AmountString))
            {
                writer.WriteString("amountString", (string)AmountString !);
            }

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

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

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

                foreach (Reference valSource in Source)
                {
                    valSource.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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