internal static ConnectivityHop DeserializeConnectivityHop(JsonElement element) { Optional <string> type = default; Optional <string> id = default; Optional <string> address = default; Optional <string> resourceId = default; Optional <IReadOnlyList <string> > nextHopIds = default; Optional <IReadOnlyList <ConnectivityIssue> > issues = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type")) { type = property.Value.GetString(); continue; } if (property.NameEquals("id")) { id = property.Value.GetString(); continue; } if (property.NameEquals("address")) { address = property.Value.GetString(); continue; } if (property.NameEquals("resourceId")) { resourceId = property.Value.GetString(); continue; } if (property.NameEquals("nextHopIds")) { List <string> array = new List <string>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(item.GetString()); } nextHopIds = array; continue; } if (property.NameEquals("issues")) { List <ConnectivityIssue> array = new List <ConnectivityIssue>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(ConnectivityIssue.DeserializeConnectivityIssue(item)); } issues = array; continue; } } return(new ConnectivityHop(type.Value, id.Value, address.Value, resourceId.Value, Optional.ToList(nextHopIds), Optional.ToList(issues))); }
internal static ConnectivityHop DeserializeConnectivityHop(JsonElement element) { string type = default; string id = default; string address = default; string resourceId = default; IReadOnlyList <string> nextHopIds = default; IReadOnlyList <ConnectivityIssue> issues = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } type = property.Value.GetString(); continue; } if (property.NameEquals("id")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } id = property.Value.GetString(); continue; } if (property.NameEquals("address")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } address = property.Value.GetString(); continue; } if (property.NameEquals("resourceId")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } resourceId = property.Value.GetString(); continue; } if (property.NameEquals("nextHopIds")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } List <string> array = new List <string>(); foreach (var item in property.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(item.GetString()); } } nextHopIds = array; continue; } if (property.NameEquals("issues")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } List <ConnectivityIssue> array = new List <ConnectivityIssue>(); foreach (var item in property.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(ConnectivityIssue.DeserializeConnectivityIssue(item)); } } issues = array; continue; } } return(new ConnectivityHop(type, id, address, resourceId, nextHopIds, issues)); }