zoukankan      html  css  js  c++  java
  • 二维json 遍历取值(前端网备份)

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>111</title>

    </head>

    <body class="gray-bg">

    <script src="js/jquery.min.js"></script>
    <script type="text/javascript">
    $(function(){
        var obj ={"total":2,"data":[{"cardDevices":[{"brand":"品牌1","id":"1","number":"21001","type":"ic","version":"1.0","window":{"$ref":"$.data[0]"}}],"id":"1","name":"1号窗口","number":"1001","operator":"张三","phone":"111111111","restaurant":"1号餐厅"},{"cardDevices":[{"brand":"品牌1","id":"2","number":"21002","type":"ic","version":"1.0","window":{"$ref":"$.data[1]"}}],"id":"2","name":"2号窗口","number":"1002","operator":"李四","phone":"12312312312","restaurant":"2号餐厅"}]}
        /*var newarr = obj.data;
        newarr.forEach(function(value,index){
            console.log(value.cardDevices[0].number)
        })*/
        for( i in obj){
            console.log('i',i);
                    var val=obj[i];
                    for( j in val){
                        //console.log('j',j);
                        console.log(val[j].cardDevices[0].number)
                    }
                }
    })
    </script>

    </body>
    </html>

  • 相关阅读:
    线程&进程
    C#入门基础
    .Net GC垃圾收集机制(下)
    .Net GC垃圾收集机制(上)
    GAC的理解及其作用
    C# DES加密,KEY和IV不同设置的写法
    常见加密算法简析
    密码学
    数字签名是什么?(数字证书)
    加密算法和MD5等散列算法的区别
  • 原文地址:https://www.cnblogs.com/lsc-boke/p/10996922.html
Copyright © 2011-2022 走看看