Home How to convert AngularJS response.data to object/array
Reply: 0

How to convert AngularJS response.data to object/array

Ramesh_Konda
1#
Ramesh_Konda Published in 2017-12-07 16:03:17Z

In AngularJS, on $http.get reponse, I am getting reponse.data as below

"Array
(
[0] => stdClass Object
    (
        [country_id] => 1
        [country_name] => India
    )

)
"

Code : $scope.countryData returning above format;

 $http.get(BASEURL+"places/getCountryList").then(function(response){
    $scope.countryData = response.data;
});

It is coming as string. How do i convert this to object/array ? From file, I am returning only object but on success its coverted as above.

Tried JSON.parse(), it didn't work.

Thanks

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.366849 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO