Home > Web Front-end > JS Tutorial > json introduction js simple example_json

json introduction js simple example_json

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 18:39:43
Original
1148 people have browsed it

The json format is very suitable for simple objects with some properties and values. Here is a simple example:


[Ctrl A Select all Note: If you need to introduce external Js, you need to refresh before executing
]
<script> var person={ //json对象定义开始 name:"脚本之家", //字符串 url:"www.jb51.net", //数字 age:"3", married:false, //布尔值 books:[ //数组,在数组中又嵌入了两个json对象 {name:"javascript",price:30}, {name:"正则表达式",price:25} ] } alert(person.books); alert(person.name+" "+person.url+" "+person.age+" "+person.books[0]["name"]); </script>The json object was successfully run and obtained Internal property value. It can be seen that the json object is very simple and easy to learn.
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Backslash present in Json
From 1970-01-01 08:00:00
0
0
0
Get: Transfer JSON data
From 1970-01-01 08:00:00
0
0
0
mysql storage json error
From 1970-01-01 08:00:00
0
0
0
javascript - Problems with displaying json data
From 1970-01-01 08:00:00
0
0
0
Find matching integers in JSON.
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template