Hi there,
So I have a json file with a basic structure, containing strings as keys
and strings as values
Before using WASM, I was just able to simply get the keys through C#'s Json library and
The keys of the json file are supposed to be selected inside the dropdown component of Radzen.
JsonConvert.DeserializeObject<Dictionary<string, string>>().Keys
This would easily give me an IEnumerable which was able to be read by the Data attribute of the dropdown
Now that I'm working with WASM, I'm supposed to use await GetFromJsonAsync<T>[]
This is what find very confusing as the result of that line can only return an array of objects
My own json file is 75 lines long of only key and values, without any arrays or new {} objects
How can I achieve the result of displaying only the keys for the dropdown component?
I tried to following with no success:
<RadzenDropDown AllowClear="true" AllowFiltering="true" FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive" @bind-Value=@Region Placeholder="Select region"
Data=@(regions.Select(r => r.region)) Class="w-50" />
@code{
Regions[]? regions;
string Customer;
string Solution;
string Region;
protected override async Task OnInitializedAsync()
{
regions = await http.GetFromJsonAsync<AzRegions[]>("Data/Regions.json");
}
protected override async Task OnInitializedAsync()
{
regions = await http.GetFromJsonAsync<Regions[]>("Regions.json");
}
public class Regions
{
public string? region { get; set; }
public string? code { get; set; }
}
}
Any help is highly appreciated, thank you