I try some way to return JSON but i am not able to do perfectly. Here is my Code
Public string GetData(){
List<Test> result = new List<Test>();
// Fill data from Database
string isonData = JsonConvert.SerializeObject(result);
return jsonData;
}
You don't need to serialize it by hand. Just return the list directly:
public IEnumerable<Test> GetData(){
List<Test> result = new List<Test>();
// Fill data from Database
return result;
}
Or better:
public IActionResult GetData(){
List<Test> result = new List<Test>();
// Fill data from Database
return Ok(result);
}