I have a client side JSON object that I want to get on the server side.
For this, I have hidden text in which I put a lowercase version of my object.
$("#<%=hidden.ClientID%>").val(JSON.stringify(obj));
Then, on the server side, I try to deserialize it using the JavaScriptSerializer.
My problem: a string object contains a date, and I cannot parse it using JavaScriptSerializer.
What I did: change the date format to fit the format. Net:
function FormatDate(date) {
if (typeof (date.getTime) != "undefined") {
return '\\/Date(' + date.getTime() + ')\\/'
}
return date;
}
It seems to give a nice format, but when I use JSON.stringify for an object with well-formatted dates, it adds an extra backslash, so JavaScriptSerializer still can't get it.
, ?