internal static AvailableProvidersListCountry DeserializeAvailableProvidersListCountry(JsonElement element) { Optional <string> countryName = default; Optional <IReadOnlyList <string> > providers = default; Optional <IReadOnlyList <AvailableProvidersListState> > states = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("countryName")) { countryName = property.Value.GetString(); continue; } if (property.NameEquals("providers")) { List <string> array = new List <string>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(item.GetString()); } providers = array; continue; } if (property.NameEquals("states")) { List <AvailableProvidersListState> array = new List <AvailableProvidersListState>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(AvailableProvidersListState.DeserializeAvailableProvidersListState(item)); } states = array; continue; } } return(new AvailableProvidersListCountry(countryName.Value, Optional.ToList(providers), Optional.ToList(states))); }
internal static AvailableProvidersListCountry DeserializeAvailableProvidersListCountry(JsonElement element) { string countryName = default; IReadOnlyList <string> providers = default; IReadOnlyList <AvailableProvidersListState> states = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("countryName")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } countryName = property.Value.GetString(); continue; } if (property.NameEquals("providers")) { 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()); } } providers = array; continue; } if (property.NameEquals("states")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } List <AvailableProvidersListState> array = new List <AvailableProvidersListState>(); foreach (var item in property.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(AvailableProvidersListState.DeserializeAvailableProvidersListState(item)); } } states = array; continue; } } return(new AvailableProvidersListCountry(countryName, providers, states)); }