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