Display List in MAUI Blazor App after json deserialization, List is not displayed in MAUI Blazor App while the jsonString is displayed. The webapi is returning value when I deserialize to list it is giving error also cannot debug the code.Please suggest on this. I checked the List and json have same schema. https://github.com/KalyanAllam/RateApp/
@page "/"
@using System.Text;
@using System.Net.Http.Headers;
@using Microsoft.AspNetCore.Components;
@using Newtonsoft.Json;
@using RateApp.Models;
@jsonString
@Questions
<table class="table">
<thead>
<tr>
<th>DaysBegin</th>
<th>DaysEnd</th>
<th>Interest</th>
<th>SrInterest</th>
</tr>
</thead>
<tbody>
@foreach (InQuestion inques in Questions)
{
// Pass the Dto properties to the component
<InQuestion DaysBegin="@inques.DaysBegin" DaysEnd="@inques.DaysEnd" Interest="@inques.Interest" SrInterest="@inques.SrInterest"/>
}
</tbody>
</table>
@code {
public class InQuestion
{
public int No { get; set; }
public int DaysBegin { get; set; }
public int DaysEnd { get; set; }
public decimal Interest { get; set; }
public decimal SrInterest { get; set; }
}
public string codex; public string jsonString ; public bool statcode;
List<InQuestion> Questions = new List<InQuestion>();
public int number; int totalquestions;
protected override async Task OnInitializedAsync()
{
string jwturl = "https://quizapijwt.azurewebsites.net/api/";
using (var client1 = new HttpClient())
{
client1.BaseAddress = new Uri(jwturl);
client1.DefaultRequestHeaders.Clear();
client1.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
HttpResponseMessage response = await client1.GetAsync("RateCards");
if (response.IsSuccessStatusCode)
{
//Storing the response details recieved from web api
jsonString = await response.Content.ReadAsStringAsync();
Questions = JsonConvert.DeserializeObject<List<InQuestion>>(jsonString);
}
}
}
}