/// <summary> /// Deserialize JSON into a FHIR ImmunizationRecommendation#DateCriterion /// </summary> public static void DeserializeJson(this ImmunizationRecommendation.DateCriterionComponent 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($"ImmunizationRecommendation.DateCriterionComponent >>> ImmunizationRecommendation#DateCriterion.{propertyName}, depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } reader.Read(); current.DeserializeJsonProperty(ref reader, options, propertyName); } } throw new JsonException($"ImmunizationRecommendation.DateCriterionComponent: invalid state! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); }
/// <summary> /// Deserialize JSON into a FHIR ImmunizationRecommendation#DateCriterion /// </summary> public static void DeserializeJsonProperty(this ImmunizationRecommendation.DateCriterionComponent 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 "value": if (reader.TokenType == JsonTokenType.Null) { current.ValueElement = new FhirDateTime(); reader.Skip(); } else { current.ValueElement = new FhirDateTime(reader.GetString()); } break; case "_value": if (current.ValueElement == null) { current.ValueElement = new FhirDateTime(); } ((Hl7.Fhir.Model.Element)current.ValueElement).DeserializeJson(ref reader, options); break; // Complex: dateCriterion, Export: DateCriterionComponent, Base: BackboneElement default: ((Hl7.Fhir.Model.BackboneElement)current).DeserializeJsonProperty(ref reader, options, propertyName); break; } }
/// <summary> /// Serialize a FHIR ImmunizationRecommendation#DateCriterion into JSON /// </summary> public static void SerializeJson(this ImmunizationRecommendation.DateCriterionComponent current, Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true) { if (includeStartObject) { writer.WriteStartObject(); } // Component: ImmunizationRecommendation#DateCriterion, Export: DateCriterionComponent, Base: BackboneElement (BackboneElement) ((Hl7.Fhir.Model.BackboneElement)current).SerializeJson(writer, options, false); writer.WritePropertyName("code"); current.Code.SerializeJson(writer, options); writer.WriteString("value", current.ValueElement.Value); if (includeStartObject) { writer.WriteEndObject(); } }