How to use JSON.parse reviver parameter to parse date string

后端 未结 6 809
醉酒成梦
醉酒成梦 2020-12-09 07:20

My JSON string contains a date field that returns such a value:

\"2009-04-04T22:55:16.0000000-04:00\"

I am particularly interested in parsi

6条回答
  •  孤街浪徒
    2020-12-09 07:26

    Extending the jQuery.ajax converters setting worked fine for me from its's default:

    "text json": jQuery.parseJSON
    

    to

    "text json": function (xmlValue) {
                var value = JSON.parse(xmlValue, Site.dateReviver);
          return value;
          } 
    

提交回复
热议问题