JSON Tutorial
JSON: JavaScriptObjectNotation (JavaScript Object Notation)
JSON is a syntax for storing and exchanging text information, similar to XML.
JSON is smaller, faster, and easier to parse than XML.
JSON is easy for humans to read and write.
Programming languages such as C, Python, C++, Java, PHP, Go, etc., support JSON.
JSON Example
{
"sites": [
{ "name":"tutorialpro.org" , "url":"www.tutorialpro.org" },
{ "name":"google" , "url":"www.google.com" },
{ "name":"微博" , "url":"www.weibo.com" }
]
}
This sites object is an array containing 3 site records (objects).
What is JSON?
JSON refers to JavaScript Object Notation (JavaScriptObjectNotation)
JSON is a lightweight text data interchange format
JSON is language-independent: JSON uses JavaScript syntax to describe data objects, but JSON is still language-independent and platform-independent. JSON parsers and JSON libraries support many different programming languages. Currently, many dynamic (PHP, JSP, .NET) programming languages support JSON.
JSON is self-describing and easier to understand
JSON - Converting to JavaScript Object
The JSON text format is syntactically identical to the code for creating JavaScript objects.
Due to this similarity, a JavaScript program can use the built-in eval() function to convert JSON data into native JavaScript objects.