Custom
JSON (Javascript Object Notation) is a lightweight data interchange format. It is based on a subset of ECMAScript. JSON takes a completely language-independent text format, but also uses a similar idiom to the C language family (c, C + +, C #, Java, JavaScript, Perl, Python, and so on). These features make JSON an ideal data exchange language. Easy to read and write, but also easy to machine parse and generate (typically used to improve network transfer rates).
Syntax
The JSON syntax is a subset of the JavaScript object representation syntax.
- Data in key-value pairs
- Data is separated by commas
- Curly braces Save Object
- Square brackets Save Array
Example
<script>var json={"code": "P001", "name": "Lao Li"}; // format-Name: value pairs (The quotation mark of the name can be added without adding) alert (Json.code); // The value is called with the variable name. Name to call </script>
Note
The JSON value can be:
- Number (integer or floating point)
- String (in double quotes)
- Logical value (TRUE or FALSE)
- Array (in square brackets)
- Object (in curly braces)
- Null
Initial knowledge of JSON