How to learn a knowledge?
First of all to ask a few questions, currently think of JSON is what, JSON is who created, why, but now only a long time ago people directly told me, JSON used to save data, for the use also forget about, so now re-understand, and master the JSON
JSON is created by Douglas Crockfor, an estimate for better data exchange and storage.
Json:javascript Object Notation (JavaScript object Notation).
JSON is the syntax for storing and exchanging textual information. Similar to XML.
JSON is smaller, faster, and easier to parse than XML
What is JSON?
- JSON refers to the JavaScript object notation (JAvaScript Object Notation)
- JSON is a lightweight text data interchange Format
- JSON is separate from the language * (I understand here as more than one language support, or not just in a single language)
- JSON is self-descriptive and easier to understand
JSON uses JAVASCRIPT syntax to describe data objects, but JSON is still independent of language and platform. The JSON parser and the JSON library support many different programming languages.
Here's a JSON representation of a person's information
var json ={"name": "Zhangsan", "Age": 34};
document.write (Json.name); The result is Zhangsan.
Use JSON to represent more than one person's information
var json =[{"name": "Zhangsan", "Age": 34},{"name": "Lisi", "Age": 12}];
Like XML
- JSON is plain text
- JSON has a "self-descriptive" (Human readable)
- JSON has a hierarchy (values exist in values)
- JSON can be parsed with JavaScript
- JSON data can be transmitted using AJAX
Compared to the difference between XML
- No end tag
- Even shorter
- Read and write faster
- Ability to parse using the built-in JavaScript eval () method
- Working with arrays
- Do not use reserved words
Why use JSON?
For AJAX applications, JSON is faster and easier to use than XML:
Split Line ****************************************************
The more you learn the more dizzy, because a lot of the foundation is not very understanding, so now the previous experience, and other people's articles to understand
JSON is one of the most popular data interchange formats, at least the JSON format in which I have used interfaces and transmitted data
In this way, the above is independent of the language, it is understood, not a language of all the characteristics, but everyone can use, the rules are basically the same
Take an example of PHP, convert an array to JSON data by Json_encode
$arr = Array (' a ' = = 1, ' b ' = = 2, ' c ' = 3, ' d ' = = 4, ' e ' = 5); echo Json_encode ($arr);
Here's the result.
{"A": 1, "B": 2, "C": 3, "D": 4, "E": 5}
Paste a few JSON knowledge URLs
Http://www.ruanyifeng.com/blog/2011/01/json_in_php.html
http://blog.jobbole.com/852/
http://www.nowamagic.net/php/php_JsonDecode.php
What is JSON?