looping through a nested json object javascript | |
---|---|
Subject: | |
object {success:true, distribution: object}
the above nested object, since its already an object you don't use JSON.parse or anything you simple find a way to loop through. Simple un-nested object $.each() in jQuery will do the trick. In this example I used a for loop for it. for(var i =0; i < data.distribution.customers.length; i++){ if(data.distribution.customers[i].field == 'to'){ console.log(data.distribution.customers[i]); } } | |
2016-09-23 09:49:51 | gstlouis |
for(var i =0; i < data.distribution.customers.length; i++){ | gstlouis |
2016-09-23 09:49:59 | |