Jess Verduzco Jess Verduzco - 1 year ago 144
HTTP Question

Cant convert JSON to array in Angular.js

Hi everyone I have some problems with angular, I made a request in $http so i have a JSON like:


and I want to convert it to an array like

{y:1, a:0}

I'd already tried whit angular.fromJson(myData) but it doesnt works
Hope you´ll help me because Im a begginer

Answer Source

This is just a hint/suggestion, something you might overlooked. It is hard to understand your question, clarify if this is not what you are looking for.

Maybe for some reason you got "{"y":"1","a":"0"}" back, which is a string. If you need to get a JSON object from it then use JSON.parse(string) function.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download