lundi 29 décembre 2014

Using JS/AngularJS to loop through an Object containing Objects and arrays based on content of JSON


How to use javascript to iterate through JSON Object containing an Object and an Array and display all elements?


When I say display all elements it is also a bit complicated!!! I need to read the content of an array in which one of the elements will be having string like "123" and I have to jump from there to the array[last element of 123 ie; 3] and display its content .And continue the normal looping.





for (var i =0; i<=ScopeVariable.ArrayInsideJSONFile.length;i++){
for(key in ScopeVariable.ArrayInsideJSONFile){
//This part of JSON is contains Many Objects of size two
loop through the object{
//In which One is a single element/normal key value pair object
display it if its an element{}
//Other One is an Array containing many objects of size 9
loop through this array{
//While looping through array .One of this array elements have a string "123"
// Have to take this string and use the last element of the string and jump to Array[last element].
//Have to continue looping using this logic for this entire array
}
}
}






Aucun commentaire:

Enregistrer un commentaire