Esempio n. 1
0
        /// <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 (!string.IsNullOrEmpty(Status))
            {
                writer.WriteString("status", (string)Status !);
            }

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

            if (!string.IsNullOrEmpty(Mode))
            {
                writer.WriteString("mode", (string)Mode !);
            }

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

            if (!string.IsNullOrEmpty(Title))
            {
                writer.WriteString("title", (string)Title !);
            }

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

            if (Code != null)
            {
                writer.WritePropertyName("code");
                Code.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 (Source != null)
            {
                writer.WritePropertyName("source");
                Source.SerializeJson(writer, options);
            }

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

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

                foreach (Annotation valNote in Note)
                {
                    valNote.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (ListEntry valEntry in Entry)
                {
                    valEntry.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
Esempio n. 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 (!string.IsNullOrEmpty(Title))
            {
                writer.WriteString("title", (string)Title !);
            }

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

            if (Code != null)
            {
                writer.WritePropertyName("code");
                Code.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 (Focus != null)
            {
                writer.WritePropertyName("focus");
                Focus.SerializeJson(writer, options);
            }

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

            if (!string.IsNullOrEmpty(Mode))
            {
                writer.WriteString("mode", (string)Mode !);
            }

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

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

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

                foreach (Reference valEntry in Entry)
                {
                    valEntry.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

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

                foreach (CompositionSection valSection in Section)
                {
                    valSection.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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