Jess Verduzco Jess Verduzco - 3 months ago 7
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:

{"y":"1","a":"0"}

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

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.

Comments