javascript 什么是JSON #whatisjson

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript 什么是JSON #whatisjson相关的知识,希望对你有一定的参考价值。

/* JavaScript Object Notation(JSON) is a standard format
 * For representing structured data as JavaScript objects
 * For representing and transmitting data on web sites(i.e.sending some data from the server to the client, so it can be displayed on a web page).
 * JSON is a data format following JavaScript object syntax developed by Douglas Crockford and uses double quotes.
 * JSON can exist as an object, or a string— the former is used when you want to read data out of the JSON, and the latter is used when you want to send the JSON across the network.
 * A JSON object can be stored in its own file, which is basically just a text file with an extension of .json, and a MIME type of application/json.
 */

// JSON structure
var data = {
  "squadName": "Super hero squad",
  "homeTown": "Metro City",
  "formed": 2016,
  "secretBase": "Super tower",
  "active": true,
  "members": [{
    "name": "Molecule Man",
    "age": 29,
    "secretIdentity": "Dan Jukes",
    "powers": [
      "Radiation resistance",
      "Turning tiny",
      "Radiation blast"
    ]
  }, {
    "name": "Madame Uppercut",
    "age": 39,
    "secretIdentity": "Jane Wilson",
    "powers": [
      "Million tonne punch",
      "Damage resistance",
      "Superhuman reflexes"
    ]
  }, {
    "name": "Eternal Flame",
    "age": 1000000,
    "secretIdentity": "Unknown",
    "powers": [
      "Immortality",
      "Heat Immunity",
      "Inferno",
      "Teleportation",
      "Interdimensional travel"
    ]
  }]
};

// Source https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/JSON

以上是关于javascript 什么是JSON #whatisjson的主要内容,如果未能解决你的问题,请参考以下文章

whatis一般怎么回答

什么是!javascript 中的函数? [复制]

JavaScript 中的 + 是啥? [复制]

Javascript 中的 += 是啥? [复制]

JavaScript 中的 32 位整数是啥?

译在JavaScript中{}+{}的结果是什么?