JSON

出自維基百科,自由嘅百科全書
跳去導覽 跳去搵嘢

JSON(全名 JavaScript Object Notation)係由 JavaScript 演變出嚟嘅一種檔案格式,常用於網絡嘅數據交流;JSON 會用人類睇得明嘅文字嚟儲同傳達包含一拃拃名-值對陣列(或者第啲做咗序列化嘅數值)嘅數據物件[1]

好似以下噉,就係用 JSON 儲住咗一個人嘅個人資料:

{
  "firstName": "John", 
  "lastName": "Smith",
  "isAlive": true,
  "age": 27,
  "address": {
    "streetAddress": "21 2nd Street",
    "city": "New York",
    "state": "NY",
    "postalCode": "10021-3100"
  },
  "phoneNumbers": [
    {
      "type": "home",
      "number": "212 555-1234"
    },
    {
      "type": "office",
      "number": "646 555-4567"
    }
  ],
  "children": [],
  "spouse": null
}

[編輯]

  1. ECMA-404: The JSON Data Interchange Format (1st ed.). Geneva: ECMA International. October 2013.