我目前正在使用一个使用API的简单网站。到目前为止,我只有原始的json数据,我以为可以使用它,直到可以进行api调用为止。如何以最简单的方式返回json数据?
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
namespace LiuOrg.Controllers
{
[ApiController]
[Route("[controller]")]
public class OrganisationController : ControllerBase
{
private string Summaries = @"{
'pointInTime': '2019-11-04T09:29:35.9425587Z',
'organisationViewType': 'Organisation',
'tree': {
'organisationId': 'efc0d74d-82323-2323',
'canonicalPath': 'LIU',
'shortName': 'LIU',
'enabled': true,
'fullName': {
'en': 'Linköping University',
'sv': 'Linköpings universitet'
},
'financialUnit': -1,
'organisationType': 'Company',
'children': [{
'organisationId': 'd1340837-2323-32323',
'canonicalPath': 'LIU/IBL',
'shortName': 'IBL',
'enabled': true,`enter code here`
....
[HttpGet]
public IActionResult Get()
{
return Json(new { Summaries });
}
} }