I have a JSON object on client side that I want to get back on server side.
To do so, I have a hidden in which I put the stringified version of my object.
$("#<%=hidden.ClientID%>").val(JSON.stringify(obj));
然后,在服务器的一面,我试图用JavaScriptSregister去消毒它。
My Problem : the stringified object contains a date and I can t parse it with de JavaScriptSerializer.
What I have done : Modify the date format to make it fit with the .Net format :
function FormatDate(date) {
if (typeof (date.getTime) != "undefined") {
return \/Date( + date.getTime() + )\/
}
return date;
}
这似乎提供了一个很好的格式, 但是, 当我使用 JSON 。 用格式化良好的日期对对象进行刻画时, 它会增加一个额外的反斜线, 所以 JavaScriptSregicizer 仍然无法获得它 。
知道我怎么才能用隐藏的 有效格式得到它吗?