Force lowercase property names from Json() in ASP.NET MVC

Posted by kouPhax on Stack Overflow See other posts from Stack Overflow or by kouPhax
Published on 2010-05-07T15:13:05Z Indexed on 2010/05/08 14:28 UTC
Read the original article Hit count: 271

Filed under:
|

Given the following class,

public class Result
{      
    public bool Success
    {
        get;
        set;
    }

    public string Message
    { 
        get; 
        set; 
    }
}

I am returning one of these in a Controller action like so,

return Json(new Result() { Success = true, Message = "test"})

However my client side framework expects these properties to be lowercase success and message. Without actually having to have lowercase property names is that a way to acheive this thought the normal Json function call?

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about JSON