Detailed explanation of Json format

Detailed explanation of Json format

JSON ( JavaScript Object Notation ) is a lightweight data exchange format. It is easy to read and understand, and easy for machines to parse and generate. JSON uses a language-independent text format and uses conventions similar to the C language family (including C, C++, C#, Java, JavaScript, Perl, Python, etc.). These features make JSON an ideal data exchange language.

A JSON is built on two structures:

A collection of name/value pairs. In different languages, this is understood as an object, record, struct, dictionary, hash table, keyed list, or associative array. An ordered list of values. In most languages, this is understood as an array.

2. JSON format

1. Object

An object is an unordered collection of name/value pairs. An object starts with a "{" (left bracket) and ends with a "}" (right bracket). Each "name" is followed by a ":" (colon); "name/value" pairs are separated by "," (commas).

2. Arrays

An array is an ordered collection of values. An array starts with "[" (left bracket) and ends with "]" (right bracket). Use "," (comma) to separate values.

The content of the three values

value can be a string enclosed in double quotes, a number , true , false , null , an object , or an array . These structures can be nested.

string is a collection of any number of Unicode characters enclosed in double quotes, using backslash escapes. A character is a single character string .

A string is very similar to a string in C or Java.

number are also very similar to numbers in C or Java. Remove unused octal and hexadecimal formats. Remove some encoding details.

Four Examples

Note: The string must be enclosed in double quotes.

Arrays and objects can be nested within arrays

{
    "name": "BeJson",
    "url": "http://www.bejson.com",
    "page": 88,
    "isNonProfit": true,
    "address": {
        "street": "Technology Park Road.",
        "city": "Suzhou, Jiangsu",
        "country": "China"
    },
    "links": [
        {
            "name": "Google",
            "url": "http://www.google.com"
        },
        {
            "name": "Baidu",
            "url": "http://www.baidu.com"
        },
        {
            "name": "SoSo",
            "url": "http://www.SoSo.com"
        }
    ]
}

Summarize

This article ends here. I hope it can be helpful to you. I also hope you can pay more attention to more content on 123WORDPRESS.COM!

You may also be interested in:
  • Detailed explanation of json file writing format
  • Understanding JSON (JavaScript Object Notation) in one article
  • JSON Introduction and Usage Summary
  • Detailed introduction to json objects in js
  • jQuery JSON parsing example
  • JSON principle analysis and example introduction
  • Introduction to JSON data format
  • Concise JSON Introduction
  • A brief introduction to json
  • Json advantages and disadvantages and usage introduction

<<:  HTML tags explained

>>:  Summary of four ways to introduce CSS (sharing)

Recommend

Detailed explanation of HTML form elements (Part 1)

HTML forms are used to collect different types of...

Detailed explanation of the construction and use of Docker private warehouse

The image can be saved on hub.docker.com, but the...

Zen coding for editplus example code description

For example, he enters: XML/HTML Code div#page>...

MySQL uses inet_aton and inet_ntoa to process IP address data

This article will introduce how to save IP addres...

Docker image cannot be deleted Error: No such image: xxxxxx solution

Preface The docker image cannot be deleted. Check...

Python Flask WeChat applet login process and login api implementation code

1. Let’s take a look at the effect first Data ret...

What we have to say about CSS absolute and relative

Written in the opening: Absolute said: "Rela...

Implementing a web calculator with native JavaScript

This article shares the specific code of JavaScri...

Detailed explanation of Docker container network port configuration process

Exposing network ports In fact, there are two par...

Detailed steps for IDEA to integrate docker to achieve remote deployment

1. Enable remote access to the docker server Log ...

Some details about semicolons in JavaScript

Preface Semicolons in JavaScript are optional, an...

Best Practices for Deploying ELK7.3.0 Log Collection Service with Docker

Write at the beginning This article only covers E...

JDBC Exploration SQLException Analysis

1. Overview of SQLException When an error occurs ...