JSON Quick Start Learning Tutorial

Source: Internet
Author: User
Tags format array object character set hash json string variable
JSON Quick Start

Three kinds of data in computer language
1, scalar a separate string or number such as "Chengdu"; 7
2, the sequence of some related data in a certain order together (array or list) such as "Beijing, Chengdu"; 7 8 9
3, mapping name/value pairs that is the data name and corresponding value is called hash (hash) or dictionary and so on, such as "Sichuan Capital: Chengdu"

JSON (JavaScript Object notation) is a lightweight data interchange Format



four basic rules for JSON
(1) The data in parallel is separated by commas (",").
(2) The mapping is represented by a colon (":").
(3) The set (array) of parallel data is represented by square brackets ("[]").
(4) The mapped collection (object) is represented by braces ("{}")

the benefits of JSON
1. The data format is relatively simple, easy to read and write, the format is compressed, occupy a small bandwidth.
2. Support a variety of languages, including Actionscript,c,c#,coldfusion,java,javascript,perl,php,python,ruby, such as server language, easy to server-side resolution.

The disadvantage of JSON
1. The required character set must be Unicode and strongly constrained.
2. Grammar is too rigorous and must conform to the four principles of the JSON syntax.

Comparison of four data formats
Xml
XML is a subset of standard Universal Markup Language (SGML) that is ideal for web transport.
XML provides a uniform way to describe and exchange structured data that is independent of applications or vendors.

Json
JSON is based on a subset of JavaScript programing Language,standard ECMA-262 3rd Edition-december 1999.

Serialize
Serialize is a JSON-like data format, but PHP's serialize lecture variable is serialized to return a string expression with variable type and struct.

Array ()
Basic data types that cannot be used for transmission and exchange of data.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.