"JSON must know and must know" reading notes (1)

1. Literal: A noun is a specific representation of a data value, and its literal meaning is exactly the same as what it wants to express.

2.JSON is based on JavaScript object literals, note that it is "based on".

3. The core of data exchange is data, so json does not involve functions in js object literals.

4. For maximum portability, spaces or special characters should be avoided as much as possible.

5. json is based on JavaScript object literals, so the json format is very similar, but the former does not require double quotes around the name in the name-value pair, but in json, it must be added.

6. In JavaScript, an object allows single quotes instead of double quotes, but json only uses double quotes.

7. The data exchange format of json can exist in the system as an independent file, and its file extension is very easy to remember: json.

8. The MIME type (media type) of json is application/json. (Note: application indicates that it is some kind of binary data)

9. In a json name-value pair, the value can be a string, number, boolean, null, object or array.

10. The data types in json include: object, string, number, boolean, null, array.

11. Object data types in json: Going back to the source, json itself is an object, that is, a list of name-value pairs wrapped in curly braces. Nesting is required if you wish to create a name-value pair in json as an object.

12. Strings in json: can be composed of any Unicode characters. Note: For the json parser, when a value begins with a double quote ("), it expects the following string literal to end with another double quote, which means that if the string itself contains double quotes, it may An error occurred, which needs to be escaped at this point.

13. For json strings, double quotes are not the only character that needs to be escaped.

14. The numbers in json can be integers, decimals, negative numbers, and exponents.

15. Boolean in json: true or false. (must be lowercase)

16. Don't confuse null with undefined, especially when using JavaScript. undefined is not a data type in json, whereas in JavaScript undefined is what is returned when trying to get some non-existent object or variable. In JavaScript, undefined relates to objects or variables whose declared names and values ​​do not exist. null is a value that represents a "no value". In json, null must be lowercase.

17. The value of a variable declared with var in JavaScript can be of any type in numbers, strings, arrays, null, and objects.

18. json is a data exchange format, if json data is passed to a system that does not use javascript, there may be errors in parsing.

19. In json, the array can contain any supported data type, the array must be enclosed in square brackets ([]), and the values ​​are separated by commas.


Guess you like

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