I have created the employee.json which will have id,firstname and lastname i am try to get the json reponse back, but postman return me an empty json object
[Route("api/[controller]")]
[ApiController]
public class EmployeeController : ControllerBase
{
public JsonResult Get()
{
var jsonFile = System.IO.File.ReadAllText(@"C:\Users\Employee.json");
List<Employee> employee = JsonConvert.DeserializeObject<List<Employee>>(jsonFile);
return new JsonResult(new Employee(1, "Toyota", "Aygo"));
}
}
here is the employee.json file
[{
"id": 1,
"firstname": "First Employee First Name",
"lastname": "First Employee Last Name"
},
{
"id": 2,
"firstname": "Second Employee First Name",
"lastname": "Second Employee Last Name"
}]
Below is the Postman response



Employeeclass properties/fields private?