[JSON]初识JSON

1:什么是json

json是,是储存和交换文本信息的语法,类似于xml,但是比xml更小,更快,更易解析.

 
2:JSON的语法规则

JSON中:数据在key/velue对中,数据由对号分隔,花括号{}保存对象,方括号保存数组[]

"key":"velue"
 
3:JSON的值
可以是数字,字符串,逻辑值,数组,对象或null
 
4:JSON对象
{"name":"冲出地球","from":"china" }
{"id":"1","name":"小明","age":"15"}
{"id":"15"}
 
5:JSON数组
["早上","中午","下午","晚上"]
[["蚌埠","0552","皖C"],["合肥","0551","皖A"],["滁州","0550","皖M"]]
 
6:JSON对象数组和数组对象
一个是对象中含有数组,一个是数组中含有对象
{
    "cityname":"蚌埠",
    "countyname":["怀远","五河","固镇"]
}

[
    {
        "cityname":"合肥",
        "countyname":["肥东","肥西","长丰","庐江"]
    },
    {
        "cityname":"蚌埠",
        "countyname":["怀远","五河","固镇"]
    }
]

 

 

posted @ 2017-04-10 12:24  郑小辉  阅读(114)  评论(0编辑  收藏