I received a JSON response in the following structure.
{
"_meta" : {
"next-person-id" : "1001",
"totalPersons" : "1000"
}
}
Utilizing Angular's $http
service, I am attempting to retrieve this data and access the next-person-id
property in JavaScript as shown below:
$http.get(url).then(
function(response){
console.log(response._meta.next-person-id);
}
);
However, whenever I try to access the next-person-id
attribute in the response, it always returns as undefined. Strangely, I can successfully access the totalPersons attribute. Could there be an issue with retrieving attributes containing '-' characters in JavaScript?