So I have the http.get call working and can correctly grab data from the request:
this.http.get('https://data.cityofnewyork.us/resource/xx67-kt59.json').subscribe(data => {
// Read the result field from the JSON response.
console.log(data);
for (let x in data) {
console.log(x);
}
});
The console.log(data) line works successfully, it prints me out an array of th e items from the request.
The trouble I'm having is when I try and iterate through each individually item in the JSON array.
for (let x in data) {
console.log(x);
}
Just prints me out the index/number of the item in the JSON object. Even if I try x["prop name"], it still fails.
Even the following doesn't work:
console.log(JSON.stringify(x));
My goal is to eventually map these to a class I'd define and populate an array variable with that data.
Am I being stupid in how I'd reference the JSON property for each item?