我正在尝试在html页面上显示json数据。服务器上的数据显示了json数据,但是当我试图在页面上显示它时,它提供了这些数据。
{"_isScalar":false,“源”:{“_isScalar”:true,"value":{"url":"https://feeds.citibikenyc.com/stations/stations.json","body":null,"reportProgress":false,"withCredentials":false,"responseType":"json","method":"GET","headers":{"normalizedNames":{},"lazyUpdate":null,"headers":{}},"params":{"updates":null,"cloneFrom":null,“编码器”:{},"map":null},"urlWithParams":"https://feeds.citibikenyc.com/stations/stations.json"},"scheduler":null},"operator":{"concurrent":1}},"operator":{}},"operator":{}}
我获取数据的代码是
import { HttpClient} from '@angular/common/http';
import { Injectable } from '@angular/core';
@Injectable()
export class GetdataService {
posts : any;
readonly ROOT_URL ="https://feeds.citibikenyc.com/stations/stations.json";
constructor(private http: HttpClient ) { }
getPosts()
{
this.posts = this.http.get(this.ROOT_URL );
return JSON.stringify(this.posts);
}
}
https://stackoverflow.com/questions/52106855
复制相似问题