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

A brief discussion on JS packaging objects

Table of contents Overview definition Instance Me...

WeChat applet uses canvas to draw clocks

This article shares the specific code of using ca...

Implementation of MySQL joint index (composite index)

Joint Index The definition of the joint index in ...

Details of MutationObServer monitoring DOM elements in JavaScript

1. Basic Use It can be instantiated through the M...

MySQL implements an example method of logging in without a password

Specific method: Step 1: Stop the mysql service /...

Solution to SNMP4J server connection timeout problem

Our network management center serves as the manag...

Detailed explanation of MySQL EXPLAIN output columns

1. Introduction The EXPLAIN statement provides in...

Analysis of the principle and usage of MySQL custom functions

This article uses examples to illustrate the prin...

Vue implements accordion effect

This article example shares the specific code of ...

Example code of how to create a collapsed header effect using only CSS

Collapsed headers are a great solution for displa...

React native ScrollView pull down refresh effect

This article shares the specific code of the pull...

js to achieve image fade-in and fade-out effect

This article shares the specific code of js to ac...

Tutorial on building file sharing service Samba under CentOS6.5

Samba Services: This content is for reference of ...

The difference between div and span in HTML (commonalities and differences)

Common points: The DIV tag and SPAN tag treat som...