JSON is all about representing structured data

《小紅書 第20章》web

定義

JSON (JavaScript Object Notation) is most widely used data format for data interchange on the web. This data interchange can happen between two computers applications at different geographical locations or running within same hardware machine.編程

數據交換的格式

JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate.json

結構化數據

`借用JS語法 JSON is a strict subset of JavaScript, making use of several patterns found in JavaScript to represent structured data.網絡

JSON can represent four primitive types (strings, numbers, booleans, and null) and two structured types (objects and arrays).app

JSON 與 XML

There was a time when XML was the de facto standard for transmitting structured data over the Internet. The fi rst iteration of web services was largely XML-based, highlighting its target of server-to-server communication.ide

結構化數據

JSON syntax allows the representation of three types of values:orm

  • Simple Values — Strings, numbers, Booleans, and null can all be represented in JSON using the same syntax as JavaScript. The special value undefined is not supported. 某一簡單「數據」:單一名值對,數據有名字(key)和數據值(value),使用冒號(:)分隔server

  • Objects — The fi rst complex data type, objects represent ordered key-value pairs. Each value may be a primitive type or a complex type. 非線性的名值組合(多個名值對) 多個(類型)不一樣的數據的「獨立組合」 使用花括號({})對象

  • Arrays — The second complex data type, arrays represent an ordered list of values that are accessible via a numeric index. The values may be of any type, including simple values, objects, and even other arrays. 線性的名值組合(多個名值對) 多個(類型)相同的數據的「獨立組合」 使用方括號([])接口

JSON 格式、JSON對象、JSON數據、JS對象

  • JSON 格式:一種用於「數據交換」的「結構化」格式規範,借鑑了JS對象字面量語法,有輕便易讀的優勢。規範規定了格式的結構規則,包括數據類型、結構複合方式等; json.org/
    • 結構化:計算須要處理數據,數據有單一,也有複合結構的
    • 數據交換:計算需協做,協做雙方是程序邏輯邊界內的不一樣的模塊,也是邊界外(包括網絡)的不一樣程序
    • 數據:Simple Values ,Objects,Arrays
  • JSON對象:全局的JSON API,用於處理「JSON數據」的編程接口
  • JSON數據:使用JSON格式的特殊的字符數據
  • JS對象:JSON對象是一種特殊的JS對象
  • JSON數據字面量與JS對象字面量:一個是數據(有規定的格式),一個是程序對象,前者只有數據,後者不只只有數據

JSON exists as a string — useful when you want to transmit data across a network. It needs to be converted to a native JavaScript object when you want to access the data. This is not a big issue — JavaScript provides a global JSON object that has methods available for converting between the two.

相關文章
相關標籤/搜索