


Detailed explanation of JSON object definition and value implementation steps in JS
May 22, 2018 am 11:53 AMThis time I will bring you a detailed explanation of the steps for JSON object definition and value implementation in JS. What are the precautions for JSON object definition and value implementation in JS. The following is a practical case, let’s take a look. one time.
1.JSON (JavaScript Object Notation) is a simple data format that is more lightweight than xml. JSON is a native JavaScript format, which means that no special API or toolkit is required to process JSON data in JavaScript.
The rules of JSON are simple: an object is an unordered collection of "name:value" pairs. An object starts with "{" (left bracket) and ends with "}" (right bracket). Each "name" is followed by a ":" (colon); "name/value" pairs are separated by "," (comma).
The rules are as follows:
1) Mapping is represented by colon (":"). Name: Value
2) Parallel data are separated by commas (","). Name 1: value 1, name 2: value 2
3) The mapped collection (object) is represented by curly brackets ("{}"). {Name 1: Value 1, Name 2: Value 2}
4) The collection (array) of parallel data is represented by square brackets ("[]").
[
{Name 1: value, name 2: value 2},
{Name 1: value, name 2: value 2}
]
5) The types that element values can have :string, number, object, array, true, false, null
Five writing methods in 2.json:
1) Traditional way to store data and call data
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
2) The first style:
1 2 3 4 5 6 7 8 9 10 |
|
3) The second style:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
4) The third style:
1 2 3 4 5 6 7 8 9 10 |
|
5) The fourth style:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
|
6) The fifth style:
1 2 3 4 5 6 7 8 9 10 |
|
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!
Recommended reading:
Detailed explanation of the steps to implement fuzzy query with jQuery
Async/await hell problem handling
The above is the detailed content of Detailed explanation of JSON object definition and value implementation steps in JS. For more information, please follow other related articles on the PHP Chinese website!

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to implement dual WeChat login on Huawei mobile phones?

How to implement the WeChat clone function on Huawei mobile phones

Performance optimization tips for converting PHP arrays to JSON

PHP Programming Guide: Methods to Implement Fibonacci Sequence

How do annotations in the Jackson library control JSON serialization and deserialization?

PHP Game Requirements Implementation Guide

Master how Golang enables game development possibilities

Quick tips for converting PHP arrays to JSON
