当前位置:网站首页>JSON defined syntax [json]
JSON defined syntax [json]
2022-07-21 18:34:00 【Java code evolution ing】
JSON The grammar of definition
grammar ( The basic rule ):
Data in name value pairs : JSON Data is made up of key value pairs
- Name value pair middle ( That is, between name and value ) Use :( The colon ) separate
- Keys can be enclosed in quotation marks , You can also use no quotes , And you can use single quotation marks or double quotation marks
- Values can be of the following types :
- Numbers ( Integer or floating point )
- character string (( Use double quotation marks )
- Boolean value (true / false)
- Array ( Square brackets ([]) in
- eg:{“persons” : [ {} , {} ] }
- The key at this time is persons, And the value is an array ( [] ), Multiple arrays can be nested JSON object
- eg:{“persons” : [ {} , {} ] }
- JSON object ( In curly brackets ( {} ) in )
- eg:{“address” : {“province” : “ shaanxi ”, … }}
- The key at this time is address, And value is another JSON object
- eg:{“address” : {“province” : “ shaanxi ”, … }}
- null
- We seldom use null As value
Data consists of commas (,) Separate
- That is, multiple key value pairs are separated by commas
Curly braces hold objects
- That is to use {}( Curly braces ) Definition JSON Format
Square brackets hold arrays
- That is to say [] ( square brackets ) Represents an array
For example, to understand : ( How to define JSON object )
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title> Definition JSON object </title>
<script> //1. Define the basic format var person = {
"name":" Zhang San ","age":23,"gender":true}; // Do a print and a test alert(person); //2. Nesting format : {} -> [] , This means JSON Object [] Array var persons = {
"persons" : [ {
"name":" Zhang San ","age":23,"gender":true}, {
"name":" Li Si ","age":23,"gender":true} ] } // Do a print and a test alert(persons); //3. Nesting format : [] -> {} , Here, it means that the array is nested JSON object var ps = [ {
"name":" Li Si ","age":23,"gender":true}, {
"name":" Li Si ","age":23,"gender":true}, {
"name":" Li Si ","age":23,"gender":true}, {
"name":" Li Si ","age":23,"gender":true} ] // Do a print and a test alert(ps); </script>
</head>
<body>
</body>
</html>
- Be careful : Here we are creating JSON object , It's just that this is JavaScript Code area , Let's create JSON The object will then be directly resolved to the corresponding JavaScript object
Be careful : We are defining JSON Objects are either used for keys ""( Double quotes ), Or use single quotation marks , Or use nothing , But we must unify , There will be no problem if it is not unified , But it will not look clear
边栏推荐
- Web3 traffic aggregation platform starfish OS gives players a new paradigm experience of metauniverse
- 2D array theme
- 图案密码锁
- 【IoT毕设.1】esp8266+机智云AIoT+猪舍监测系统设计与实现
- Dataframe draw correlation coefficient fitting line scatter plot fitting line
- 齐岳mof|CdS [email protected]|甲基丙烯酸磺基甜菜碱(pSBMA)接枝改性UiO-66-PEI|活性氧化铝负载FeMOF绿色复合粒料
- 金属有机框架MIL-101(Cr)负载壳聚糖材料|MIL-101(Cr)@CS|甘草次酸(GA)修饰金属有机框架材料UiO-66-NH2(UiO-66- NH2-GA)
- Polyethyleneimine (PEI) modified mil-101 (CR) | polyacid based metal organic framework material (pom-mof) | ferrocene modified mil-88b | Qiyue biology
- Review the knowledge points of thinking and practice - "Ideological and moral basis and legal cultivation"
- ant. The date selection of rangepicker in time datepicker in design (antd for short) is limited to the date before 0 o'clock of a certain day
猜你喜欢
Nonext fast medical image segmentation network based on MLP
聚乙烯亚胺(PEI)改性MIL-101(Cr)|多酸基金属有机框架材料(POM-MOF)|二茂铁改性MIL-88B|齐岳生物
与时俱进的不止是产品 从卡罗拉锐放看一汽丰田“二次创业”的信心
[email pr"/>
Metal organic framework mil-100 (CR) and mil-101 (CR) Supported Phosphotungstic Acid | zirconium based metal organic framework [email pr
Metal organic framework mil-101 (CR) loaded chitosan material | mil-101 (CR) @cs | glycyrrhetinic acid (GA) modified metal organic framework material uio-66-nh2 (uio-66- NH2 GA)
【IoT毕设.2】STM32F407单片机+机智云AIoT+猪舍监测与系统总体方案设计
pytorch-California House Prices
Polyethyleneimine (PEI) modified mil-101 (CR) | polyacid based metal organic framework material (pom-mof) | ferrocene modified mil-88b | Qiyue biology
C AES CBC mode encryption and decryption
USB eye map common sense
随机推荐
ctfshow web入门(phpcve)
Oracle數據庫中查詢一個時間段內的記錄,如果其中某一天的記錄沒有,則取最近一天的記錄填充,這個SQL應該怎麼寫呢?
【IoT毕设.1】esp8266+机智云AIoT+猪舍监测系统设计与实现
ctfshow web入门(文件包含)
洛谷P5142 区间方差 题解
onmousemove=alert(1) style='width
Installation and use tutorial of labelimg (object detection and annotation tool)
Browsersync web server setup
Mysql字符集和排序规则
To solve the inherent defects of CNN, ccnn realizes multiple SOTAS with a single architecture
UneXt 基于MLP的快速医学图像分割网络
国内疫情反反复复,线下实体店的如何转型才能突破困境?
Getting started with ctfshow web (included in the file)
EasyNVS定制项目中的播放器更新及相应新功能增加
pytorch-California House Prices
Pattern code lock
Excel does not count repeatedly through sumproduct and countifs (the data contains blank cells)
Page break before and page break after realize paging printing
LabelImg(目标检测标注工具)的安装与使用教程
table自动分页