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.

相关文章
相关标签/搜索