当前位置:网站首页>What is JSON? First acquaintance with JSON
What is JSON? First acquaintance with JSON
2022-04-23 05:46:00 【DK_ ten thousand and thirty-two】
Learning goals :
Can skillfully use in development JSON Format storage data 、 How to access the JSON data
JSON The definition of :
JSON (JavaScript Object Notation) yes ⼀ A lightweight data exchange format . Easy to ⼈ Read and write . It's also easy to machine analyze and ⽣ become . It's based on JavaScript Programming Language, Standard ECMA-262 3rd Edition -December 1999 Of ⼀ individual ⼦ Set . JSON Mining ⽤ Totally alone ⽴ Yu Yu ⾔ Of ⽂ This format , But it also makes ⽤ It's similar to C language ⾔ Family habits ( Include C, C++, C#, Java, JavaScript, Perl, Python etc. ). These characteristics make JSON Become an ideal data exchange language ⾔.
In standard json In the format ,json Objects are enclosed in parentheses , The properties in the object are json Of key yes ⼀ A string , therefore ⼀ Make sure that ⽤ Double quotation marks . Each group key Between ⽤ Comma in ⾏ Separate .
Json Define format :
var Variable name = {
"key1" : value , // Number type
"key2" : "value" , // String type
"key3" : [] , // An array type
"key4" : {
}, // json object type
"key5" : [{
},{
}] // json Array
};
JSON Object access :
json object , seeing the name of a thing one thinks of its function , I know it is ⼀ Objects .⾥⾯ Of key It's the properties of the object . We are going to visit ⼀ Properties of an object ,
Just make ⽤【 Object name . Property name 】 Of ⽅ It's easy to access .
for example :
<script type="text/javascript"> // 1. Definition JSON var j1 = {
"name":" Zhang San ","age":18}; alert(j1.name+","+j1.age); // Zhang San ,18 // Array var j2 = {
"names":["aa","bb","cc"]} alert(j2.names[1]); // bb //json An array of content var j3 = {
"users":[{
"name":" Zhang San ","age":18},{
"name":" Zhang San 2","age":14},{
"name":" Zhang San 3","age":12}]}; alert(j3.users[0].name); // Zhang San </script>
The following is the page source code , Save as *.html Open the page with a browser , You can see the result directly
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>JSONTest</title>
<script type="text/javascript"> // 1. Definition JSON var j1 = {
"name":" Zhang San ","age":18}; alert(j1.name+","+j1.age); // Zhang San ,18 // Array var j2 = {
"names":["aa","bb","cc"]} alert(j2.names[1]); // bb //json An array of content var j3 = {
"users":[{
"name":" Zhang San ","age":18},{
"name":" Zhang San 2","age":14},{
"name":" Zhang San 3","age":12}]}; alert(j3.users[0].name); // Zhang San </script>
</head>
<body>
<h1> JSON Study </h1>
</body>
</html>
版权声明
本文为[DK_ ten thousand and thirty-two]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220534093892.html
边栏推荐
- Ora: 28547 connection to server failed probable Oracle net admin error
- idea插件---背景播放歌曲
- 尚硅谷 p290 多态性练习
- AcWing 1096. Detailed notes of Dungeon Master (3D BFS) code
- The role of brackets' [] 'in the parameter writing method in MDN documents
- jdbc入门\获取数据库连接\使用PreparedStatement
- 多线程与高并发(1)——线程的基本知识(实现,常用方法,状态)
- Shell instruction learning 1
- 提升Facebook触及率和互动率攻略 | 智能客服帮您抓住用户的心
- Character recognition easyocr
猜你喜欢

Isosceles triangle - the 9th Lanqiao provincial competition - group C

Navicate连接oracle(11g)时ORA:28547 Connection to server failed probable Oeacle Net admin error

Breadth first search topics (BFS)

Radar equipment (greedy)

多线程与高并发(1)——线程的基本知识(实现,常用方法,状态)

Data mining -- understanding data

引航成长·匠心赋能——YonMaster开发者培训领航计划全面开启

3d slicer中拉直体的生成

Common protocols of OSI layer

After adding qmenu to qtoolbutton and QPushButton, remove the triangle icon in the lower right corner
随机推荐
实体中list属性为空或者null,设置为空数组
Formal parameters, local variables and local static variables
poi导出excel,行相同数据自动合并单元格
refused connection
引航成长·匠心赋能——YonMaster开发者培训领航计划全面开启
Use of qwbengneview and qwebchannel.
转置卷积(Transposed Convolution)
QSslSocket::connectToHostEncrypted: TLS initialization failed
The 8th Blue Bridge Cup 2017 - frog jumping cup
Sword finger offer II 022 The entry node of the link in the linked list
C语言——恶搞关机小程序
2-软件设计原则
QT compressed folder
excel获取两列数据的差异数据
Strategy for improving the conversion rate of independent stations | recovering abandoned users
Common status codes
Linear sieve method (prime sieve)
MySQL lock mechanism
No.1.#_ 6 Navicat shortcuts
Differences between sea level anatomy and sea surface height anatomy