/// <summary> /// Deserialize JSON into a FHIR MedicinalProductPharmaceutical#WithdrawalPeriod /// </summary> public static void DeserializeJson(this MedicinalProductPharmaceutical.WithdrawalPeriodComponent 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($"MedicinalProductPharmaceutical.WithdrawalPeriodComponent >>> MedicinalProductPharmaceutical#WithdrawalPeriod.{propertyName}, depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } reader.Read(); current.DeserializeJsonProperty(ref reader, options, propertyName); } } throw new JsonException($"MedicinalProductPharmaceutical.WithdrawalPeriodComponent: invalid state! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); }
/// <summary> /// Serialize a FHIR MedicinalProductPharmaceutical#WithdrawalPeriod into JSON /// </summary> public static void SerializeJson(this MedicinalProductPharmaceutical.WithdrawalPeriodComponent current, Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true) { if (includeStartObject) { writer.WriteStartObject(); } // Component: MedicinalProductPharmaceutical#WithdrawalPeriod, Export: WithdrawalPeriodComponent, Base: BackboneElement (BackboneElement) ((Hl7.Fhir.Model.BackboneElement)current).SerializeJson(writer, options, false); writer.WritePropertyName("tissue"); current.Tissue.SerializeJson(writer, options); writer.WritePropertyName("value"); current.Value.SerializeJson(writer, options); if (current.SupportingInformationElement != null) { if (!string.IsNullOrEmpty(current.SupportingInformationElement.Value)) { writer.WriteString("supportingInformation", current.SupportingInformationElement.Value); } if (current.SupportingInformationElement.HasExtensions() || (!string.IsNullOrEmpty(current.SupportingInformationElement.ElementId))) { JsonStreamUtilities.SerializeExtensionList(writer, options, "_supportingInformation", false, current.SupportingInformationElement.Extension, current.SupportingInformationElement.ElementId); } } if (includeStartObject) { writer.WriteEndObject(); } }
/// <summary> /// Deserialize JSON into a FHIR MedicinalProductPharmaceutical#WithdrawalPeriod /// </summary> public static void DeserializeJsonProperty(this MedicinalProductPharmaceutical.WithdrawalPeriodComponent current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName) { switch (propertyName) { case "tissue": current.Tissue = new Hl7.Fhir.Model.CodeableConcept(); ((Hl7.Fhir.Model.CodeableConcept)current.Tissue).DeserializeJson(ref reader, options); break; case "value": current.Value = new Hl7.Fhir.Model.Quantity(); ((Hl7.Fhir.Model.Quantity)current.Value).DeserializeJson(ref reader, options); break; case "supportingInformation": if (reader.TokenType == JsonTokenType.Null) { current.SupportingInformationElement = new FhirString(); reader.Skip(); } else { current.SupportingInformationElement = new FhirString(reader.GetString()); } break; case "_supportingInformation": if (current.SupportingInformationElement == null) { current.SupportingInformationElement = new FhirString(); } ((Hl7.Fhir.Model.Element)current.SupportingInformationElement).DeserializeJson(ref reader, options); break; // Complex: withdrawalPeriod, Export: WithdrawalPeriodComponent, Base: BackboneElement default: ((Hl7.Fhir.Model.BackboneElement)current).DeserializeJsonProperty(ref reader, options, propertyName); break; } }