search
HomeCommon ProblemWhat is json format

What is json format

Oct 30, 2020 am 11:28 AM
json format

There are two json formats, namely: 1. Object format [{"key1":obj, "key2":obj, "key3":obj...}]; 2. Array or collection format , [[obj,obj,obj...]].

What is json format

The role of json (json is a language-independent data exchange format)

  • Use ajax for front-end and back-end data exchange

  • Data exchange between mobile terminal and server

It is convenient to use Json format and parsing Represents an object information, json has two formats:

1) Object format: {"key1":obj,"key2":obj,"key3":obj...}

2) Array/collection format: [obj, obj, obj...]

For example: the user object is represented in json data format

{"username":"zhangsan","age":28,"password":"123","addr":"北京"}

List json data format representation

[{"pid":"10","pname":"小米4C"},{},{}]

As long as it is an object, use {enclosed}, as long as it is a collection, use []enclosed

Note: Object format and array format can be nested in each other, an object An attribute in can be a collection or array

The key of json is a string and the value of json is Object

What is json format

This object contains username, age , password, addr, account attributes, where the value of the account attribute is also an object

Example

After we write the object in json format, we want to get this The attributes of the object can be obtained by just clicking on the object level one level like Java. See the following example

What is json format

This one has a person object, person.lastname You can directly get the value of person's lastname

What is json format

This person is a collection, there are two objects in the collection, person[1] is the first object in the collection

What is json format

json is an object. This object has an attribute baobao. The value of baobao is a collection, json. baobao[1] is the first object to obtain the baobao value

What is json format

This json is an object with three attributes. The first attribute is a simple value. The second attribute is an object, and the third attribute is a collection.

The above things are all written in <script>, so json is the native content of js, which means that js can directly To take out the data in the json object, as long as the var object name = json format object, we can directly obtain the data in the object through the name of the object format in js without parsing </script>

Related free recommendations: Programming Video Course

The above is the detailed content of What is json format. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version