JSON: Java Script Object b Object (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
·
JSON is a lightweight text data
exchange format
·
JSON is language independent:
JSON uses JavaScript syntax to describe data objects, but JSON is still
language and platform independent. The JSON parser and JSON library support many
different programming languages. Currently, a very large number
of dynamic (PHP, JSP, .NET) programming languages support JSON.
·
JSON is self-explanatory and
easier to understand
JSON - Convert to JavaScript object
The JSON text format is
syntactically the same as the code that creates a JavaScript object.
Because of this similarity,
without a parser, JavaScript programs can generate native JavaScript objects
using JSON data using the built-in eval () function.
Same as XML
·
JSON is plain text
·
JSON has a "self-descriptive" (human-readable)
·
JSON has a hierarchy (values have values)
·
JSON parses through JavaScript
·
JSON data can be transmitted using AJAX
Difference
with XML
·
There is no end tag
·
Shorter
·
Read and write faster
·
Ability to use the built-in JavaScript eval () method
for parsing
·
Use an array
·
Do not use reserved words
Why
use JSON?
JSON
is faster and easier to use than XML for AJAX applications:
Use XML
·
Read the XML document
·
Use the XML DOM to loop through the document
·
Read the value and store it in a variable
Use JSON
·
Read JSON string
·
Use eval () to handle JSON strings
EmoticonEmoticon