Proper Way to Convert JSON Date to .NET DateTime During Deserialization

前端 未结 6 1267
暖寄归人
暖寄归人 2020-12-06 01:12

I have a javascript function that calls an MVC controller with JSON data:

var specsAsJson = JSON.stringify(specs);
$.post(\'/Home/Save\', { jsonData: specsAs         


        
6条回答
  •  無奈伤痛
    2020-12-06 01:55

    I found this piece of code on the internet. It worked like a charm for me...

    function customJSONstringify(obj) {
        return JSON.stringify(obj).replace(/\/Date/g, "\\\/Date").replace(/\)\//g, "\)\\\/")
    }
    

提交回复
热议问题