Jsonシリアライズ・デシリアライズ

参考

qiita.com

サンプル

 public class BaseApiController : ApiController
{
    protected IHttpActionResult CreateResponse(BaseResponse res)
    {
        return this.Json(res, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore });
    }

    protected IHttpActionResult CreateErrorResponse(BaseResponse res, int status, int errorCode, string msg)
    {
        res.SetError(status, errorCode, msg);
        return this.Json(res, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore });
    }
}