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

Mysql uses insert to insert multiple records to add data in batches

If you want to insert 5 records into table1, the ...

MySQL 8.0.15 installation graphic tutorial and database basics

MySQL software installation and database basics a...

Detailed analysis of the parameter file my.cnf of MySQL in Ubuntu

Preface Based on my understanding of MySQL, I thi...

Mini Program to Implement the Complete Shopping Cart

The mini program implements a complete shopping c...

Summary of MySQL common functions

Preface: The MySQL database provides a wide range...

Causes and solutions for MySQL data loss

Table of contents Preface Problem Description Cau...

Design and implementation of Vue cascading drop-down box

Table of contents 1. Database design 2. Front-end...

Nginx solves cross-domain issues and embeds third-party pages

Table of contents Preface difficulty Cross-domain...

How to apply TypeScript classes in Vue projects

Table of contents 1. Introduction 2. Use 1. @Comp...