它是壹種嚴格的js對象格式。JSON的屬性名必須有雙引號,如果值是字符串,也必須有雙引號。
JSON只是壹種數據格式(或數據形式);
& lt腳本& gtvar obj 2 = { };//這只是JS對象varobj3 = {width: 100,height:200 };/*這個與JSON無關,而是JS */varobj4 = {'width': 100,' height': 200}的對象;/*這個和JSON無關,但是JS object */varobj 5 = { " width ":100," height": 200," name ":" rose " };/*我們可以把這個叫做JSON格式的JavaScript對象*/varstr 1 = ' { " width ":100," height": 200," name ":" rose " } ';/*我們可以這樣稱呼:JSON格式字符串*/var a = [{"width": 100," height": 200," name": "rose"},{"width": 100," height": 200," name。/*這個JSON格式的數組是稍微復雜壹點的JSON */var str 2 = '['+'{"width": 100," height": 200," name": "rose"},'+' { " width ":100。'+ '{"width":100," height":200," name":"rose"},'+']';/*這被稱為稍微復雜壹點的JSON格式字符串*/
JSON和JS對象的比較表