JSON: JavaScript Object Notation
object literal的子集合, 屬性一定要包在雙引號中
網路傳輸資料時的格式
var objectLiteral = { firstname : 'Mary', isAProgramer: true } //物件轉為JSON字串 console.log(JSON.stringify(objectLiteral)) //JSON var JsonValue = JSON.parse('{ "firstname" : 'Mary', "isAProgramer": true }'); //JSON字串轉為物件 console.log(JsonValue)
Last updated 4 years ago
Was this helpful?