Completely master json

小云云
Release: 2023-03-22 09:54:02
Original
1303 people have browsed it

This article mainly shares with you what json is, so that you can fully master json, and I hope it can help you.

1.What isjson

The full English name of json is JavaScript Object Notation (it is an independent language and does not belong to JavaScript!!!)

json is a lightweight data exchange format that is easy to understand.

2.json syntax rules

Data is key/value pairs.

Data is separated by commas

Curly brackets save the object

Square brackets save the array

3.jsonData format

Key-value pair:

The key and value are both in double quotes, with a colon in the middle (equivalent to the equal sign), indicating a set of data

"name":"json"
Copy after login

Object:


{"name":"json","sex":"boy"}
Copy after login

Array:


"res":[
    {"firstName":"Tom","where":"A"},
    {"firstName":"John","where":"B"},
    {"firstName":"Sam","where":"C"}
]
Copy after login

Format explanation

1. An object can have multiple attributes, one attribute corresponds to one value, the object is used { } , the attributes and values ​​must be wrapped with "", the attributes and values ​​are separated by fire, and the attributes are separated by fire. Separate with commas,

For example: {fiestName” : “Tom”, “where” : “A” }

2.Use commas between multiple objects Separate;

3.The value can be an array, and the array contains many objects

4.jsonThe outermost layer needs to be { }Package

Related recommendations:

Detailed explanation of json_encode() and json_decode() functions in php

How to output json object in php

How to read local json file in php

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!