I am using the Values controller in Net Core VS 2019 to send JSON data back instead of string. This is the syntax I am using that is not accurate:
[Route("api/[controller]")]
[ApiController]
public class ValuesController : ControllerBase
{
// GET api/values
[HttpGet]
public JsonResult Get()
{
return new JsonResult({
"heroesUrl": "api/heroes",
"textfile": "assets/textfile.txt"
});
}
}
I get red squiggly lines indicating a syntax error on the JSON objecs in the {}.