I have a JSON response in the following format.
{
"_meta" : {
"next-person-id" : "1001",
"totalPersons" : "1000"
}
}
I am using Angular's $http
service to retrieve this and trying to access next-person-id
attribute in javascript like the following,
$http.get(url).then(
function(response){
console.log(response._meta.next-person-id);
}
);
But the next-person-id
in the response is undefined always. But I'm able to access totalPersons attribute. Is there any problem with getting attributes with '-' character in javascript?