Consider the following TypeScript class:
export class Spot {
public flight:number;
public dateAndTimes:Map<string,string>
public unitCost:number;
constructor(){
this.flight=0;
this.dateAndTimes= new Map<string,string>();
this.unitCost=0;
}
}
How can I convert the Spot object to JSON?
I try JSON.stringify(spot)
, but the attribute dateAndTimes
it's serialized as empty... for example:
"spot": {
'flight':2,
{},
'unitCost':3500
}
Thank you very much!