zoukankan      html  css  js  c++  java
  • JSON应用笔记一

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    </head>
    
    <body>
    
    <script>
    var people = {
        "programmers":[
            {
                "firstName":"Brett",
                "lastName":"McLaughlin",
                "email":"aaaa"
            },
            {
                "firstName":"Jason",
                "lastName":"Hunter",
                "email":"bbbb"
            },
            {
                "firstName":"Elliotte",
                "lastName":"Harold",
                "email":"cccc"
            }
        ],
        "authors":[
            {
                "firstName":"Isaac",
                "lastName":"Asimov",
                "genre":"science fiction"
            },
            {
                "firstName":"Tad",
                "lastName":"Williams",
                "genre":"fantasy"
            },
            {
                "firstName":"Frank",
                "lastName":"Peretti",
                "genre":"christian fiction"
            }
        ],
        "musicians":[
            {
                "firstName":"Eric",
                "lastName":"Clapton",
                "instrument":"guitar"
            },
            {
                "firstName":"Sergei",
                "lastName":"Rachmaninoff",
                "instrument":"piano"
            }
        ]
    };
    alert(people.programmers[0].lastName);  
    //数组索引是从零开始,这行代码首先访问 people变量中然后移动到称为 programmers的条目,再移动到第一个记录([0]);最后,访问 lastName键的值。结果是字符串值 “McLaughlin”。的数据;
    alert(JSON.stringify(people)); 
    //json序列化转字符串
    //字符串的在线解析及序列换验证,参考json.cn
    </script>
    </body>
    </html>
  • 相关阅读:
    python爬取哦漫画
    NLP系列(2)_用朴素贝叶斯进行文本分类(上)
    svm 笔记
    nlp学习笔记
    LR
    bp网络全解读
    最小二乘法
    学习参考
    pandas中的quantile函数
    泰坦尼克号与小费与乘客数量与 鸢尾花数据集
  • 原文地址:https://www.cnblogs.com/vscss/p/5673255.html
Copyright © 2011-2022 走看看