You are on page 1of 6

JSON (JavaScript Object Notation):

 JSON or JavaScript Object Notation is a lightweight, text-based, open standard designed for
human-readable data interchange.
 easy for humans to read and write.
 easy for machines to parse and generate.
 It is based on a subset of the JavaScript Programming Language Standard .
 JSON is a text format that is completely language independent but uses conventions that are
familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript,
Perl, Python, and many others.
 These properties make JSON an ideal data-interchange language.
 The filename extension is .json.
 JSON Internet Media type is application/json.
 The Uniform Type Identifier is public.json.
 JSON grew out of a need for stateless, real-time server-to-browser communication protocol
without using browser plugins such as Flash or Java applets,

JSON is built on two structures:

1. A collection of name/value pairs: In various languages, this is realized as an object, record,


struct, dictionary, hash table, keyed list, or associative array.
2. An ordered list of values: In most languages, this is realized as an array, vector, list, or sequence.
These are universal data structures. Virtually all modern programming languages support them
in one form or another.
(These two structures is common to most of the programing language, which make them
suitable for use in Json (data format that is interchangeable with programming)

Uses of JSON :

 JSON grew out of a need for stateless, real-time server-to-browser communication protocol
without using browser plugins such as Flash or Java applets,
 JSON format is used for serializing and transmitting structured data over network connection.
 It is primarily used to transmit data between a server and web applications.
 Used for writing JavaScript based applications like browser extensions and websites.
 Web services and APIs use JSON format to provide public data.
 It can be used with modern programming languages.

Sample Example:

Syntax

var json-object-name = { string : "string value", .......}


<html>
<head>
<title>JSON example</title>
<script language = "javascript" >
var object1 = { "language" : "Java", "author" : "herbert
schildt" };
document.write("<h1>JSON with JavaScript example</h1>");
document.write("<br>");
document.write("<h3>Language = " +
object1.language+"</h3>");
document.write("<h3>Author = " + object1.author+"</h3>");

var object2 = { "language" : "C++", "author" : "E-


Balagurusamy" };
document.write("<br>");
document.write("<h3>Language = " +
object2.language+"</h3>");
document.write("<h3>Author = " + object2.author+"</h3>");

document.write("<hr />");
document.write(object2.language + " programming language
can be studied " + "from book written by " + object2.author);
document.write("<hr />");
</script>
</head>

<body>
</body>
</html>

JSON - Comparison with XML :

JSON and XML are human readable formats and are language independent. They both have support for
creation, reading and decoding in real world situations. We can compare JSON with XML, based on the
following factors −

1. Verbose (Using More words than are needed) : XML is more verbose than JSON, so it is faster to
write JSON for programmers. JSON doesn't use end tag,
2. Arrays Usage: XML is used to describe the structured data, which doesn't include arrays whereas
JSON include arrays.
3. Parsing: JavaScript's eval method parses JSON. When applied to JSON, eval returns the described
object.
4. XML has to be parsed with an XML parser. JSON can be parsed by a standard JavaScript function.
HTML – Overview
HTML stands for Hypertext Markup Language, and it is the most widely used language
to write Web Pages.
 Hypertext refers to the way in which Web pages (HTML documents) are linked together.
Thus, the link available on a webpage is called Hypertext.
 As its name suggests, HTML is a Markup Language which means you use HTML to simply
"mark-up" a text document with tags that tell a Web browser how to structure it to display.
Originally, HTML was developed with the intent of defining the structure of documents
like headings, paragraphs, lists, and so forth to facilitate the sharing of scientific
information between researchers.
Now, HTML is being widely used to format web pages with the help of different tags
available in HTML language.
Basic HTML Document
In its simplest form, following is an example of an HTML document −
<!DOCTYPE html>
<html>
<head>
<title>This is document title</title>
</head>
<body>
<h1>This is a heading</h1>
<p>Document content goes here.....</p>
</body>
</html>
HTML Tags
As told earlier, HTML is a markup language and makes use of various tags to format the
content. These tags are enclosed within angle braces <Tag Name>. Except few tags,
most of the tags have their corresponding closing tags. For example, <html> has its
closing tag </html> and <body> tag has its closing tag </body> tag etc.

Above example of HTML document uses the following tags −


Sr.No Tag & Description
1 <!DOCTYPE...> : This tag defines the document type and HTML version.
2 <html> :This tag encloses the complete HTML document and mainly comprises
of document header which is represented by <head>...</head> and document body
which is represented by <body>...</body> tags.
3 <head> : This tag represents the document's header which can keep other HTML
tags like <title>, <link> etc.
4 <title> : it is used inside the <head> tag to mention the document title.
5 <body> : This tag represents the document's body which keeps other HTML tags
like <h1>, <div>, <p> etc.
6 <h1> : This tag represents the heading.
7 <p> : This tag represents a paragraph.

HTML Document Structure


A typical HTML document will have the following structure −
<html>
<head>
Document header related tags
</head>
<body>
Document body related tags
</body>

</html>
XML – Overview
XML stands for Extensible Markup Language. It is a text-based markup language
derived from Standard Generalized Markup Language (SGML).
XML tags identify the data and are used to store and organize the data, rather than
specifying how to display it like HTML tags, which are used to display the data. XML is
not going to replace HTML in the near future, but it introduces new possibilities.
Important characteristics of XML that make it useful in a variety of systems and solutions

 XML is extensible − XML allows you to create your own self-descriptive tags, or language,
that suits your application.
 XML carries the data, does not present it − XML allows you to store the data irrespective
of how it will be presented.
 XML is a public standard − XML was developed by an organization called the World Wide
Web Consortium (W3C) and is available as an open standard.

XML Usage
A short list of XML usage says it all −
 XML can work behind the scene to simplify the creation of HTML documents for large web
sites.
 XML can be used to exchange the information between organizations and systems.
 XML can be used for offloading and reloading of databases.
 XML can be used to store and arrange the data, which can customize your data handling
needs.
 XML can easily be merged with style sheets to create almost any desired output.
 Virtually, any type of data can be expressed as an XML document.

What is Markup?
XML is a markup language that defines set of rules for encoding documents in a format
that is both human-readable and machine-readable. So what exactly is a markup
language? Markup is information added to a document that enhances its meaning
in certain ways, in that it identifies the parts and how they relate to each other.
More specifically, a markup language is a set of symbols that can be placed in the
text of a document to demarcate and label the parts of that document.
Following example shows how XML markup looks, when embedded in a piece of text −
<message>
<text>Hello, world!</text>
</message>
This snippet includes the markup symbols, or the tags such as
<message>...</message> and <text>... </text>. The tags <message> and </message>
mark the start and the end of the XML code fragment. The tags <text> and </text>
surround the text Hello, world!.

Is XML a Programming Language?


A programming language consists of grammar rules and its own vocabulary which is
used to create computer programs. These programs instruct the computer to perform
specific tasks. XML does not qualify to be a programming language as it does not
perform any computation or algorithms. It is usually stored in a simple text file and is
processed by special software that is capable of interpreting XML.

You might also like