JSON format data How to traverse, here we can use for. In implementation
For example, the simplest JSON format
varJson1 = {'name':'Small Drill Wind',' Age': -,'Handsome':'Yes' }; for(varKeyinchJson1) {Console.log (Key+' : '+Json1[key]); }
Another version of the upgrade, as follows
varJson1 = { 'name': ['Echo','Small Drill Wind','Mom sells batches .','Small White Rabbit'], ' Age': [' -',' -',' +',' -']}; for(varIinchJson1) { for(varj =0; j<json1[i].length;j++) {Console.log (i+":"+json1[i][j])}}
The output is as follows
So how does the JSON array traverse it, as follows:
varJson1 = [{'name':'Echo',' Age':' -'},{'name':'Small Drill Wind',' Age':' -'},{'name':'Mom sells batches .',' Age':' +'}] for(vari =0; i<json1.length;i++){ for(varJinchJson1[i]) {Console.log (J+":"+json1[i][j])}}
This article is mainly for the convenience of personal memory and write, ideas for reference y_y1208 blog
JSON format loop traversal, JSON array loop traversal