/// <summary> /// Deserialize JSON into a FHIR MeasureReport#StratifierGroupPopulation /// </summary> public static void DeserializeJson(this MeasureReport.StratifierGroupPopulationComponent current, ref Utf8JsonReader reader, JsonSerializerOptions options) { string propertyName; while (reader.Read()) { if (reader.TokenType == JsonTokenType.EndObject) { return; } if (reader.TokenType == JsonTokenType.PropertyName) { propertyName = reader.GetString(); if (Hl7.Fhir.Serialization.FhirSerializerOptions.Debug) { Console.WriteLine($"MeasureReport.StratifierGroupPopulationComponent >>> MeasureReport#StratifierGroupPopulation.{propertyName}, depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } reader.Read(); current.DeserializeJsonProperty(ref reader, options, propertyName); } } throw new JsonException($"MeasureReport.StratifierGroupPopulationComponent: invalid state! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); }
/// <summary> /// Deserialize JSON into a FHIR MeasureReport#StratifierGroupPopulation /// </summary> public static void DeserializeJsonProperty(this MeasureReport.StratifierGroupPopulationComponent current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName) { switch (propertyName) { case "code": current.Code = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.Code).DeserializeJson(ref reader, options); break; case "count": if (reader.TokenType == JsonTokenType.Null) { current.CountElement = new Integer(); reader.Skip(); } else { current.CountElement = new Integer(reader.GetInt32()); } break; case "_count": if (current.CountElement == null) { current.CountElement = new Integer(); } ((Hl7.Fhir.Model.Element)current.CountElement).DeserializeJson(ref reader, options); break; case "subjectResults": current.SubjectResults = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.SubjectResults).DeserializeJson(ref reader, options); break; // Complex: population, Export: StratifierGroupPopulationComponent, Base: BackboneElement default: ((Hl7.Fhir.Model.BackboneElement)current).DeserializeJsonProperty(ref reader, options, propertyName); break; } }
/// <summary> /// Serialize a FHIR MeasureReport#StratifierGroupPopulation into JSON /// </summary> public static void SerializeJson(this MeasureReport.StratifierGroupPopulationComponent current, Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true) { if (includeStartObject) { writer.WriteStartObject(); } // Component: MeasureReport#StratifierGroupPopulation, Export: StratifierGroupPopulationComponent, Base: BackboneElement (BackboneElement) ((Hl7.Fhir.Model.BackboneElement)current).SerializeJson(writer, options, false); if (current.Code != null) { writer.WritePropertyName("code"); current.Code.SerializeJson(writer, options); } if (current.CountElement != null) { if (current.CountElement.Value != null) { writer.WriteNumber("count", (int)current.CountElement.Value); } if (current.CountElement.HasExtensions() || (!string.IsNullOrEmpty(current.CountElement.ElementId))) { JsonStreamUtilities.SerializeExtensionList(writer, options, "_count", false, current.CountElement.Extension, current.CountElement.ElementId); } } if (current.SubjectResults != null) { writer.WritePropertyName("subjectResults"); current.SubjectResults.SerializeJson(writer, options); } if (includeStartObject) { writer.WriteEndObject(); } }