Why is json commonly used?

青灯夜游
Release: 2019-08-07 17:58:18
Original
2865 people have browsed it

Why is json commonly used?

What is JSON?

JSON (JavaScript Object Notation, JS Object Notation) is a lightweight data exchange format. It is based on a subset of ECMAScript (the js specification developed by the European Computer Association) and uses a text format that is completely independent of programming languages to store and represent data. Simplicity and clear hierarchical structure make JSON an ideal data exchange language. It is easy for people to read and write, and it is also easy for machines to parse and generate, and effectively improves network transmission efficiency.

JSON vs. XML comparison

Why is json commonly used?

XML code:

  中国  黑龙江  哈尔滨 大庆    广东  广州 深圳 珠海    台湾  台北 高雄    新疆  乌鲁木齐   
Copy after login

JSON code:

{ "name": "中国", "province": [{ "name": "黑龙江", "cities": { "city": ["哈尔滨", "大庆"] } }, { "name": "广东", "cities": { "city": ["广州", "深圳", "珠海"] } }, { "name": "台湾", "cities": { "city": ["台北", "高雄"] } }, { "name": "新疆", "cities": { "city": ["乌鲁木齐"] } }] }
Copy after login

JSON code hierarchy is clearer and easier to read. Due to the simplicity of characters, JSON is better than XML during data transmission and can reduce the bandwidth occupied by data transmission

Why use JSON?

Reasons for using JSON:

● JSON data is clear

● JSON has many tool classes to support its conversion

● JSON in all Mainstream browsers have good support

● JSON has a smaller data volume during transmission

● JSON has a natural language advantage in JS (because it is a standard subset)

The above is the detailed content of Why is json commonly used?. 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
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!