I have an Angular 2 application. A service is requests data from an api that returns the results like the following:
{
\"data\":[
{\"id\":1,\"ti
JSON does not provide any date specification, so it is entirely up to how it is serialized/deserialized.
You could use reviver
parameter of JSON.parse
:
this._http.get(this._getListUrl).map(res => JSON.parse(res.text(), this.reviver));
reviver(key, value):any
{
if('timestamp' === key){
//you can use any de-serialization algorithm here
return new Date(value);
}
return value;
}