json数据

json 数据

<script type="text/javascript">
 var person1 = {"firstname":"Zhang","lastname":"json","age":20};
       alert(person1.lastname);
       
       var person2 = [
                     {"firstname":"landf","lastname":"sdfsd"}, 
                     {"firstname":"landf1","lastname":"sdfsd2"}             
                     ];
       alert(person2[1].lastname);
       var person3 = {
           "persontest1":[
                         {"firstname":"landf","lastname":"sdfsd3"}, 
                         {"firstname":"landf1","lastname":"sdfsd6"}
                        ],
                        "persontest2":[
                            {"firstname":"landf","lastname":"sdfsd31"}, 
                            {"firstname":"landf1","lastname":"sdfsd61"}
                           ]                
    
                      };
       //alert(person3.persontest2[1].lastname);
       
       var person4 = {
               "key1":"Zhang",
               "key2":{"firstname":"landf","lastname":"sdfsd"},
               "key3":[
                             {"firstname":"landf","lastname":"sdfsd3"}, 
                             {"firstname":"landf1","lastname":"sdfsd6"}
                            ],
                            "persontest2":[
                                {"firstname":"landf","lastname":"sdfsd31"}, 
                                {"firstname":"landf1","lastname":"sdfsd61"}
                               ]                
        
                     };
       alert(person4.key3[1].lastname);
</script>

 

posted @ 2018-08-22 02:11  抽象Java  阅读(152)  评论(0编辑  收藏  举报