Basic concepts of JSON:
JSON full name: Java Script Object Natation. That is, the object representation of JavaScript.
It has been developed into a lightweight data exchange format.
Features: Does not depend on any language, cross-platform.
The usage scenario is mainly used for data transfer between different languages
The difference between JSON and XML/Properties:
1. JSON is lightweight, while XML is heavyweight, currently XML is generally used for configuration
2. JSON is structured, and Properties are just Key/Value
JSON official website syntax:
There are mainly two formats, one is an object and the other is an array. Groups can contain objects, and objects can contain arrays.
An object
is an unordered collection of "'name/value' pairs". An object begins with "{" (left bracket) and ends with "}" (right bracket). Each 'name' is followed by a ':' (colon); 'name/value' pairs are separated by a ',' (comma).
example:
An array
is an ordered collection of values. An array starts with "[" (left bracket) and ends with "]" (right bracket). Use "," (comma) to separate the values.
example:
The value
can be a string enclosed in double quotes, a number, true, false, null, an object, or an array. These structures can be nested.
A string
is a collection of any number of Unicode characters enclosed in double quotes, escaped with a backslash. A character is a single character string.
JSON strings are very similar to C or Java strings.
The legend is actually just escaped with '\', the same as C syntax.
Numbers
are also very similar to C or Java numbers. It's just that the JSON values are not in octal and hexadecimal format.
The diagram means that the numbers are represented like this:8.25e+7
How to handle the Static property:
In Java, static methods cannot be converted to JSON format, because static methods belong to classes, not objects.
Solution:
use map format or build Json format yourself
Example of building a Json format: In fact, it is also a Map format in the end.
JSONObject object = new JSONObject();
object.put("age", "18");
I learned the mind mapping tool before, and the content is the same as above when I use it for the first time.
Reference: Detailed explanation of JSON configuration on
Json official website
[fine talk about micro video]