The data is saved in a json file. I want the data of the id segment in the json data. How can I get it and convert it into string type?
json:
[{
"id": "AD01",
"imgurl": "images/banner_01.jpg",
"bannerurl": [
{"bannerimgurl": "images/banner_04.jpg"},
{"bannerimgurl": "images/banner_05.jpg"}],
"status": "0"
},
{
"id": "AD02",
"imgurl": "images/banner_02.jpg",
"bannerurl": [
{"bannerimgurl": "images/banner_04.jpg"},
{"bannerimgurl": "images/banner_03.jpg"}],
"status": "0"
}]
js:
$http.get("json/test.json").success(function(response){$scope.datas = response;
alert(JSON.stringify($scope.datas));//这样获取到的只是整个json的内容。
//alert(JSON.stringify($scope.datas.id));这样返回的值是undefined。
}).error(function(){})
Let’s traverse this json object
.....
I usually match loadsh#result
May I ask if your problem has been solved? I also encountered this problem
You try this
Has the original poster solved it?