关闭json解析器

关闭json解析器,json,angular,Json,Angular,服务器以纯文本响应,并尝试解析json。如何在一个组件中改变这种行为 get(mrn: string): Observable<string> { let url: string; url = this.Url; url = url + '?mrn=' + mrn; return this.http.get<string>(url); } download(testobject: Testobject): void { th

服务器以纯文本响应,并尝试解析json。如何在一个组件中改变这种行为

get(mrn: string): Observable<string> {
    let url: string;
    url = this.Url;
    url = url + '?mrn=' + mrn;
    return this.http.get<string>(url);
  }


download(testobject: Testobject): void {
    this.httpService.get(testobject.mrn)
      .subscribe(ccresult => {
        console.log('ccresult ist: ' + ccresult);
      });
  }
get(mrn:string):可观察{
让url:string;
url=this.url;
url=url+'?mrn='+mrn;
返回此.http.get(url);
}
下载(testobject:testobject):void{
this.httpService.get(testobject.mrn)
.subscribe(ccresult=>{
console.log('ccresult-ist:'+ccresult);
});
}
错误:错误:语法错误:JSON中的意外标记N位于XMLHttp的JSON.parse()位置0处……

您可以获得如下对象:

this.http.get<any>(url, { observe: 'response' }).map((res): HttpResponse) => ...);
this.http.get(url,{observe:'response'}).map((res:HttpResponse)=>…);
您可以获得如下对象:

this.http.get<any>(url, { observe: 'response' }).map((res): HttpResponse) => ...);
this.http.get(url,{observe:'response'}).map((res:HttpResponse)=>…);
。。