I have a Json schema like this:
{"THEMES":{
"CATEGORY":
["TEST1","TEST2","TEST3","DFSDFSDF"],
"OVER AGAIN":
["YOUNG","OLD","GRANPA"],
"AND AGAIN":
["AND","ANOTHER","WORD"],
"NEW CATEGORY":
["AGAIN","OOPS","CAN","REDBULL"]
}}
Well, I need to retrieve the keys values inside an AngularJs Controller and my code to retrieve it is like:
$http.get('json/word_bank.json')
.success(function (result) {
$scope.themes = Object.keys(result.TEMAS);
console.log($scope.themes);
And I get in my console: ["CATEGORY", "OVER AGAIN", "AND AGAIN", "NEW CATEGORY"]
So far so good, but I need to access the keys values like TEST1, TEST2, etc. For this i've tried, for example: console.log($scope.themes[0][0]);
And the console return the letter "C" or the first letter of the "CATEGORY" string. And this is happening with all of the rest, so the code is transforming my initial array into string elements, I guess. I already tried a lot of loops or iterations over the array, but I not works. Am I missing something?
0index at the top of your array.arr['THEMES']['CATEGORY'][1]would bring backTEST2