Return JsonResult from web api without its properties

前端 未结 4 2060
日久生厌
日久生厌 2021-01-31 10:34

I have a Web API controller and from there I\'m returning an object as JSON from an action.

I\'m doing that like this:

public ActionResult GetAllNotifica         


        
4条回答
  •  逝去的感伤
    2021-01-31 10:55

    return JsonConvert.SerializeObject(images.ToList(), Formatting.None, new JsonSerializerSettings { PreserveReferencesHandling = PreserveReferencesHandling.None, ReferenceLoopHandling = ReferenceLoopHandling.Ignore });
    
    
    using Newtonsoft.Json;
    

提交回复
热议问题