Hi,
i'm struggling to figure out how to pull data from nested objects using the REST Api. i'm trying to retrieve the values of a category list from my blogs site which is a lookup column to the posts list in the blog. Issues is the values are nested deep within
multiple objects. any help will do on how i can pull the highlighted values in the attached snippet.
var glblognews = function getBlogItems () {
// execute AJAX request
$.ajax({
url: _spPageContextInfo.webAbsoluteUrl + "/Blog/_api/web/lists/getbytitle('Posts')/items?
$select=Title,PostCategory/Title,Region/Title&$expand=PostCategory,Region",
type: "GET",
headers: { "ACCEPT": "application/json;odata=verbose" },
success: function (data) {
var dataRes = data.d.results;
var dataRes2;
for (i=0; i< data.d.results.length; i++) {
console.log(dataRes[i].Title);
dataRes2 = dataRes[i].PostCategory;
console.log(dataRes2);
}
},
error: function () {
alert("Failed to get details");
}
});
}Any pointers will help please.
thanks