J2EE Week 7 (04.16-04.22)

JSON

1. Definition

  JSON (JavaScript Object Notation, JS Object Notation) is a lightweight data interchange format. It is based on a subset of ECMAScript (the js specification developed by the European Computer Association), and uses a text format that is completely independent of the programming language to store and represent data. Concise and clear hierarchy makes JSON an ideal data exchange language. It is easy for humans to read and write, but also easy for machines to parse and generate, and effectively improve the efficiency of network transmission.

2. Features

  JSON is a lightweight data interchange format that is well readable and easy to write quickly. Data can be exchanged between different platforms. json is a subset of javaScript object representation syntax. There are only two structures in json: objects and arrays. The value of json consists of numbers, strings, logical values, arrays, objects, null, etc.

3. Advantages

  • Compared with XML, JSON is more concise, we can see the content at a glance, which is convenient for checking and debugging
  • JSON is more lightweight, whether it is writing, transmitting, or parsing is more efficient
  • JSON adopts compression technology in the transmission process, which saves more bandwidth
  • Numerous language support, such as javascript, python, C, C++ and other mainstream languages ​​are supported

4. Grammar rules

1. JSON is a collection of "name/value pairs", for example: "key1:value1".

2. The value of JSON can be a string enclosed in double brackets, a numeric value, true, false, null, an object or an array.

3. JSON has two structures, one is an object and the other is an array.

Object: An unordered collection of "name/value pairs". An object starts with '"{" and ends with "}". Each "name" is followed by a colon ":" "Name/value pairs" are separated by ", (comma)". The overall is enclosed in "{}".

格式:{“key1”:value1,"key2":value2,"key3":value3,......}

Array: An ordered collection of values. An array starts with "[" and ends with "]". Values ​​are separated by ",", and the total is enclosed by "[]".

格式:[{"key1":value1,"key2":value2,"key3":value3},{"key1":value1,"key2":value2,"key3":value3}.....]

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324691443&siteId=291194637