直接上代码:
确保json是可访问的
http://localhost:54843/dist/appsettings.json文件
{
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
},
"freetrial": {
"id": "01",
"imgurl": "images/1.jpg",
"status": "0"
}
}
http请求:
this.http.get(url).subscribe(data => {
console.log(data);
let url = data.json().Logging;
let urlss = data.json().Logging.IncludeScopes;
let xx = data.json().freetrial.id;
let sTaskName = data.json()["Logging"];
});