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 TagDetails(string id, string tagName, TagCount count, IReadOnlyList <TagValue> values) { Id = id; TagName = tagName; Count = count; Values = values; }
internal static TagValue DeserializeTagValue(JsonElement element) { string id = default; string tagValue = default; TagCount count = 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("tagValue")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } tagValue = property.Value.GetString(); continue; } if (property.NameEquals("count")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } count = TagCount.DeserializeTagCount(property.Value); continue; } } return(new TagValue(id, tagValue, count)); }