Here is a snippet of my json data:
{
"Temp": [
{
"dt": 1485717216,
"temp":30,
"time":"05:17:55 PM"
}
]
}
By parsing the above json, I can extract the temperature and time values using Angular -
ngOnInit() {
this._weather.dailyForecast()
.subscribe(data => {
let temp = data['Temp'].map(data => data.temp)
let time = data['Temp'].map(data => data.time)
}
}
However, I am encountering difficulties when trying to parse the following json data-
{
"temp":30,
"time":"05:17:55 PM"
}
Could someone please advise me on how to parse this json data?
Updated code: Service code
export class WeatherService {
constructor(private _http: HttpClient) { }
dailyForecast() {
return this._http.get("----url----")
.map(response => response);
}
}