I have an object that has DateTime properties, I am wondering if there is a way to override the default format that gets converted for Json responses.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Unfortunately no, the date format is fixed on .NET 3.5 and 4.0.
There is a workaround – which isn’t too pretty – which is to declare auxiliary properties to be serialized of type string, similar to the example below. It works, but you need to do it for every DateTime property in your object graph.