user2783193 user2783193 - 2 years ago 113
AngularJS Question

manipulating json data and simple for statement

If I'm getting some data as an array

var data = {"answer":"OK","data":[["Marco","123"],["John","44245"],["Wayne","645464"]]}

how can I inside loop iterate trough them and print inside console this coresponding values

Marco 123
John 44254, ..

Marco - 123
John - 44245, ...
for (var i = 0; i < data.length; i++) {


Answer Source

data is a key of data object.You need to first retrieve the value of which will return an array. Now loop through each of these array elements to get the values.

var data =  {"answer":"OK",

var getData =; //data key is an array



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