JavaScript in JSON using its own summary _ basics

Source: Internet
Author: User
Summarize the use of JSON yourself:
Copy Code code as follows:

var json = {"100_3322.jpg": {"name": "Small Zhang", "Height": 175},
"100_3396.jpg": {"name": "Xiao Wang", "Height": 165},
"100_3444.jpg": {"name": "Diao cicada", "Height": 185}, "100_3543.jpg": {"name": "Xi Shi", "height": 190}
};

Key gets the 100--3322.jpg, etc.

Key.name gets a little Zhang, etc.

Key.height gets 175 and so on.

================================================
Copy Code code as follows:

var json = [{"Name": "Baidu", "href": "http://www.baidu.com"}, {"Name": "Cnbeta", "href": "http://www.cnbeta.com"}, { ' Name ': ' Cnblogs ', ' href ': ' http://www.cnblogs.com '}];

Can be used at the time of traversal

Json[i].href get each link value

Json[i].name get each link name

================================================
Copy Code code as follows:

var json = {"Hebei province": ["Shijiazhuang", "Handan", "Baoding"],
"Henan Province": ["Zhengzhou", "Luoyang", "Anyang"],
"Shandong Province": ["Jinan", "Qingdao", "Dezhou"]
}

Key get Hebei province etc

Json[key] Get the following array contents of Hebei province ["Shijiazhuang", "Handan", "Baoding"]
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.