internal static TagDetails DeserializeTagDetails(JsonElement element) { string id = default; string tagName = default; TagCount count = default; IReadOnlyList <TagValue> values = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } id = property.Value.GetString(); continue; } if (property.NameEquals("tagName")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } tagName = property.Value.GetString(); continue; } if (property.NameEquals("count")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } count = TagCount.DeserializeTagCount(property.Value); continue; } if (property.NameEquals("values")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } List <TagValue> array = new List <TagValue>(); foreach (var item in property.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(TagValue.DeserializeTagValue(item)); } } values = array; continue; } } return(new TagDetails(id, tagName, count, values)); }
internal static TagDetails DeserializeTagDetails(JsonElement element) { Optional <string> id = default; Optional <string> tagName = default; Optional <TagCount> count = default; Optional <IReadOnlyList <TagValue> > values = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) { id = property.Value.GetString(); continue; } if (property.NameEquals("tagName")) { tagName = property.Value.GetString(); continue; } if (property.NameEquals("count")) { count = TagCount.DeserializeTagCount(property.Value); continue; } if (property.NameEquals("values")) { List <TagValue> array = new List <TagValue>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(TagValue.DeserializeTagValue(item)); } values = array; continue; } } return(new TagDetails(id.Value, tagName.Value, count.Value, Optional.ToList(values))); }