C# API Return string instead of XML wrapped string

后端 未结 3 843
栀梦
栀梦 2021-01-28 03:18

I\'m using ApiController and I can\'t get the call to return anything other than XML.

public class GuideController : ApiController
{
    [AcceptVerbs(\"GET\")]

         


        
3条回答
  •  情话喂你
    2021-01-28 03:48

    Try to return JSON explicitly.

    [HttpGet]
    public IHttpActionResult Get()
    {
        Item item = Item.GetTestData();       
        return Json(item);
    }
    

提交回复
热议问题