How to return JSON in an ApiController for a single method in MVC

How to return JSON in an ApiController for a single method in MVC

public class XmlEampleController : ApiController
{
    [HttpPost]
    [ActionName("YourOderAction")]
    public HttpResponseMessage YourOder([FromBody]MyOder order)
    {
        if (order != null)
        {
            return Request.CreateResponse<YourOder>(HttpStatusCode.Created, order);
        }
        return Request.CreateResponse(HttpStatusCode.BadRequest);
    }

[Serializable]
public partial class YourOder
{
    private string dataField;
    public string YourData
    {
        get
        {
            return this.dataField;
        }
        set
        {
            this.dataField = value;
        }
    }
}

}

2020-03-01