JSON标准格式

来源:互联网 发布:农村淘宝 编辑:程序博客网 时间:2024/05/16 01:20

标准JSON的合法符号:{(左大括号)  }(右大括号)  "(双引号)  :(冒号)  ,(逗号)  [(左中括号)  ](右中括号)


JSON字符串:特殊字符可在字符前面加 \ 或使用 \u 加 4位16进制数来处理

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. {"name":"jobs"}  

JSON布尔:必须小写的true和false

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. {"bool":true}  

JSON空:必须小写的null

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. {"object":null}  

JSON数值:不能使用8/16进制

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. {"num":60}  
  2. {"num":-60}  
  3. {"num":6.6666}  
  4. {"num":1e+6}<!-- 1乘10的6次方,e不区分大小写 -->  
  5. {"num":1e-6}<!-- 1乘10的负6次方,e不区分大小写 -->  

JSON对象

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. {  
  2.     "starcraft": {  
  3.         "INC": "Blizzard",  
  4.         "price": 60  
  5.     }  
  6. }  

JSON数组

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. {  
  2.     "person": [  
  3.         "jobs",  
  4.         60  
  5.     ]  
  6. }  

JSON对象数组

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. {  
  2.     "array": [  
  3.         {  
  4.             "name": "jobs"  
  5.         },  
  6.         {  
  7.             "name": "bill",  
  8.             "age": 60  
  9.         },  
  10.         {  
  11.             "product": "war3",  
  12.             "type": "game",  
  13.             "popular": true,  
  14.             "price": 60  
  15.         }  
  16.     ]  
  17. }  

0 0
原创粉丝点击